mirror of
https://github.com/ViViDboarder/bitwarden_rs.git
synced 2024-11-22 05:06:37 +00:00
Changed reinvite check and removed obsolete comment
This commit is contained in:
parent
673adde9f1
commit
21b85b78b1
@ -534,17 +534,19 @@ fn reinvite_user(org_id: String, user_org: String, headers: AdminHeaders, conn:
|
|||||||
|
|
||||||
let user_org = match UserOrganization::find_by_uuid(&user_org, &conn) {
|
let user_org = match UserOrganization::find_by_uuid(&user_org, &conn) {
|
||||||
Some(user_org) => user_org,
|
Some(user_org) => user_org,
|
||||||
None => err!("UserOrg not found."),
|
None => err!("The user hasn't been invited to the organization."),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if user_org.status != UserOrgStatus::Invited as i32 {
|
||||||
|
err!("The user is already accepted or confirmed to the organization")
|
||||||
|
}
|
||||||
|
|
||||||
let user = match User::find_by_uuid(&user_org.user_uuid, &conn) {
|
let user = match User::find_by_uuid(&user_org.user_uuid, &conn) {
|
||||||
Some(user) => user,
|
Some(user) => user,
|
||||||
None => err!("User not found."),
|
None => err!("User not found."),
|
||||||
};
|
};
|
||||||
|
|
||||||
if Invitation::find_by_mail(&user.email, &conn).is_none() {
|
Invitation::take(&user.email, &conn);
|
||||||
err!("No invitation found for user to resend. Try inviting them first.")
|
|
||||||
}
|
|
||||||
|
|
||||||
let org_name = match Organization::find_by_uuid(&org_id, &conn) {
|
let org_name = match Organization::find_by_uuid(&org_id, &conn) {
|
||||||
Some(org) => org.name,
|
Some(org) => org.name,
|
||||||
@ -583,7 +585,6 @@ fn accept_invite(_org_id: String, _org_user_id: String, data: JsonUpcase<AcceptD
|
|||||||
Some(_) => {
|
Some(_) => {
|
||||||
Invitation::take(&claims.email, &conn);
|
Invitation::take(&claims.email, &conn);
|
||||||
if claims.user_org_id.is_some() && claims.org_id.is_some() {
|
if claims.user_org_id.is_some() && claims.org_id.is_some() {
|
||||||
// If this isn't the virtual_org, mark userorg as accepted
|
|
||||||
let mut user_org =
|
let mut user_org =
|
||||||
match UserOrganization::find_by_uuid_and_org(&claims.user_org_id.unwrap(), &claims.org_id.clone().unwrap(), &conn) {
|
match UserOrganization::find_by_uuid_and_org(&claims.user_org_id.unwrap(), &claims.org_id.clone().unwrap(), &conn) {
|
||||||
Some(user_org) => user_org,
|
Some(user_org) => user_org,
|
||||||
|
Loading…
Reference in New Issue
Block a user