aboutsummaryrefslogtreecommitdiff
path: root/src/api/core
diff options
context:
space:
mode:
authorDaniel GarcĂ­a <[email protected]>2021-10-19 20:14:29 +0200
committerGitHub <[email protected]>2021-10-19 20:14:29 +0200
commitf94ac6ca61e24952e3906018ee54615cf9c123ec (patch)
treefb1031de6f9b5619161c5123023adb554fb30543 /src/api/core
parent016fe2269e3079be65f86c4887b959341c984bfa (diff)
parentcee3fd5ba284f376cd05755dbc9cd6b7ded297ed (diff)
downloadvaultwarden-f94ac6ca61e24952e3906018ee54615cf9c123ec.tar.gz
vaultwarden-f94ac6ca61e24952e3906018ee54615cf9c123ec.zip
Merge pull request #2044 from jjlin/emergency-access-cleanup1.23.0
Emergency Access cleanup
Diffstat (limited to 'src/api/core')
-rw-r--r--src/api/core/accounts.rs7
-rw-r--r--src/api/core/emergency_access.rs8
2 files changed, 7 insertions, 8 deletions
diff --git a/src/api/core/accounts.rs b/src/api/core/accounts.rs
index 4e613a37..93636889 100644
--- a/src/api/core/accounts.rs
+++ b/src/api/core/accounts.rs
@@ -91,10 +91,9 @@ fn register(data: JsonUpcase<RegisterData>, conn: DbConn) -> EmptyResult {
user
} else if CONFIG.is_signup_allowed(&email) {
// check if it's invited by emergency contact
- if EmergencyAccess::find_invited_by_grantee_email(&data.Email, &conn).is_some() {
- user
- } else {
- 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 {
err!("Registration not allowed or user already exists")
diff --git a/src/api/core/emergency_access.rs b/src/api/core/emergency_access.rs
index 50c885e4..439c9ba4 100644
--- a/src/api/core/emergency_access.rs
+++ b/src/api/core/emergency_access.rs
@@ -464,7 +464,7 @@ fn initiate_emergency_access(emer_id: String, headers: Headers, conn: DbConn) ->
mail::send_emergency_access_recovery_initiated(
&grantor_user.email,
&initiating_user.name,
- emergency_access.get_atype_as_str(),
+ emergency_access.get_type_as_str(),
&emergency_access.wait_time_days.clone().to_string(),
)?;
}
@@ -743,7 +743,7 @@ pub fn emergency_request_timeout_job(pool: DbPool) {
mail::send_emergency_access_recovery_timed_out(
&grantor_user.email,
&grantee_user.name.clone(),
- emer.get_atype_as_str(),
+ emer.get_type_as_str(),
)
.expect("Error on sending email");
@@ -792,8 +792,8 @@ pub fn emergency_notification_reminder_job(pool: DbPool) {
mail::send_emergency_access_recovery_reminder(
&grantor_user.email,
&grantee_user.name.clone(),
- emer.get_atype_as_str(),
- &emer.wait_time_days.to_string(),
+ emer.get_type_as_str(),
+ &emer.wait_time_days.to_string(), // TODO(jjlin): This should be the number of days left.
)
.expect("Error on sending email");
}