-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Fix SSO_ONLY users unable to accept org invites (#7072) #7079
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1102,6 +1102,11 @@ async fn send_invite( | |
| if !CONFIG.mail_enabled() && !user.password_hash.is_empty() { | ||
| member_status = MembershipStatus::Accepted as i32; | ||
| } | ||
| // SSO_ONLY users have no master password and cannot use the email invite | ||
| // acceptance flow, so automatically accept them | ||
| if CONFIG.sso_enabled() && CONFIG.sso_only() && user.password_hash.is_empty() { | ||
| member_status = MembershipStatus::Accepted as i32; | ||
| } | ||
|
pmhnam marked this conversation as resolved.
|
||
| user | ||
| } | ||
| } | ||
|
|
@@ -1113,7 +1118,10 @@ async fn send_invite( | |
| new_member.status = member_status; | ||
| new_member.save(&conn).await?; | ||
|
|
||
| if CONFIG.mail_enabled() { | ||
| // Only send the invite email if the member is still in the Invited state. | ||
| // SSO_ONLY users are auto-accepted above and should not receive an invite | ||
| // email with a link they cannot use. | ||
| if CONFIG.mail_enabled() && member_status == MembershipStatus::Invited as i32 { | ||
|
Comment on lines
+1121
to
+1124
|
||
| let org_name = match Organization::find_by_uuid(&org_id, &conn).await { | ||
| Some(org) => org.name, | ||
| None => err!("Error looking up organization"), | ||
|
|
@@ -1249,12 +1257,18 @@ async fn _reinvite_member( | |
| err!("Invitations are not allowed.") | ||
| } | ||
|
|
||
| let org_name = match Organization::find_by_uuid(org_id, conn).await { | ||
| Some(org) => org.name, | ||
| None => err!("Error looking up organization."), | ||
| }; | ||
|
|
||
| if CONFIG.mail_enabled() { | ||
| if CONFIG.sso_enabled() && CONFIG.sso_only() && user.password_hash.is_empty() { | ||
| // SSO_ONLY users have no master password and cannot use the email invite | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here, this statement is not true |
||
| // acceptance flow, so automatically accept them | ||
| Invitation::take(&user.email, conn).await; | ||
| let mut member = member; | ||
| member.status = MembershipStatus::Accepted as i32; | ||
| member.save(conn).await?; | ||
|
Comment on lines
+1264
to
+1266
|
||
| } else if CONFIG.mail_enabled() { | ||
| let org_name = match Organization::find_by_uuid(org_id, conn).await { | ||
| Some(org) => org.name, | ||
| None => err!("Error looking up organization."), | ||
| }; | ||
| mail::send_invite(&user, org_id.clone(), member.uuid, &org_name, Some(invited_by_email.to_string())).await?; | ||
| } else if user.password_hash.is_empty() { | ||
| let invitation = Invitation::new(&user.email); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SSO_ONLY User do have a master-password, not sure why you think this isn't the case.
I'm not sure regarding the flow though how that works. But every user still needs a master-password.
SSO In Bitwarden isn't just login.