From 76b7de15de7211684e05deacbbaa3e3bfd3ee051 Mon Sep 17 00:00:00 2001 From: BlackDex Date: Fri, 7 Jan 2022 18:55:48 +0100 Subject: [PATCH] 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. --- src/api/core/accounts.rs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/api/core/accounts.rs b/src/api/core/accounts.rs index e3ebcde0..66de801f 100644 --- a/src/api/core/accounts.rs +++ b/src/api/core/accounts.rs @@ -87,14 +87,11 @@ fn register(data: JsonUpcase, conn: DbConn) -> EmptyResult { user_org.status = UserOrgStatus::Accepted as i32; user_org.save(&conn)?; } - + user + } else if EmergencyAccess::find_invited_by_grantee_email(&email, &conn).is_some() { user } else if CONFIG.is_signup_allowed(&email) { - // check if it's invited by emergency contact - match EmergencyAccess::find_invited_by_grantee_email(&data.Email, &conn) { - Some(_) => user, - _ => err!("Account with this email already exists"), - } + err!("Account with this email already exists") } else { err!("Registration not allowed or user already exists") }