Browse Source
Fix emergency access invites for new users
If a new user gets invited it should check if the user is invited via
emergency access, if so, allow that user to register.
pull/2217/head
BlackDex
3 years ago
No known key found for this signature in database
GPG Key ID: 58C80A2AA6C765E1
1 changed files with
3 additions and
6 deletions
-
src/api/core/accounts.rs
|
@ -87,14 +87,11 @@ fn register(data: JsonUpcase<RegisterData>, conn: DbConn) -> EmptyResult { |
|
|
user_org.status = UserOrgStatus::Accepted as i32; |
|
|
user_org.status = UserOrgStatus::Accepted as i32; |
|
|
user_org.save(&conn)?; |
|
|
user_org.save(&conn)?; |
|
|
} |
|
|
} |
|
|
|
|
|
user |
|
|
|
|
|
} else if EmergencyAccess::find_invited_by_grantee_email(&email, &conn).is_some() { |
|
|
user |
|
|
user |
|
|
} else if CONFIG.is_signup_allowed(&email) { |
|
|
} else if CONFIG.is_signup_allowed(&email) { |
|
|
// check if it's invited by emergency contact
|
|
|
err!("Account with this email already exists") |
|
|
match EmergencyAccess::find_invited_by_grantee_email(&data.Email, &conn) { |
|
|
|
|
|
Some(_) => user, |
|
|
|
|
|
_ => err!("Account with this email already exists"), |
|
|
|
|
|
} |
|
|
|
|
|
} else { |
|
|
} else { |
|
|
err!("Registration not allowed or user already exists") |
|
|
err!("Registration not allowed or user already exists") |
|
|
} |
|
|
} |
|
|