dani-garcia / vaultwarden

Unofficial Bitwarden compatible server written in Rust, formerly known as bitwarden_rs
GNU Affero General Public License v3.0
34.71k stars 1.69k forks source link

Cannot re-send invitation to organisation when invitations_allowed==false #4640

Open tribut opened 3 weeks ago

tribut commented 3 weeks ago

Subject of the issue

When invitations_allowed is set to false, the button "Resend invitation" in the organization view does not work. Instead, the error message "Invitations are not allowed" is shown.

Your environment (Generated via diagnostics page)

Steps to reproduce

  1. Disable invitations_allowed
  2. Invite an existing user to an organization
  3. On the members tab, click the three-dot-menu next to the user and select "resend invitation"

Expected behaviour

The invitation email is resent.

Actual behaviour

The error message "Invitations are not allowed" is shown.

BlackDex commented 3 weeks ago

Thanks, looks like we need to move that check and depend on if the user already had an account on the system.

stefan0xC commented 1 week ago

This check is also wrong, if a user already exists they should be accepted immediately if mail is disabled: https://github.com/dani-garcia/vaultwarden/blob/a4c7fadbf4ffa242fb78ebd152080028e7f2993c/src/api/core/organizations.rs#L1004-L1006 (This should only happen in case you had mail enabled invited a user and then disabled mails before the user accepted the invitation.)