diff options
author | Daniel <[email protected]> | 2024-08-07 23:45:41 +0300 |
---|---|---|
committer | GitHub <[email protected]> | 2024-08-07 22:45:41 +0200 |
commit | e7d5c17ff7943cae63ed57e07e1ff40e47666413 (patch) | |
tree | 94c165c5d40045d8976b98436ca1604c9a66b599 | |
parent | a7be8fab9b9c6d1d8368af6320564e330d4ca384 (diff) | |
download | vaultwarden-e7d5c17ff7943cae63ed57e07e1ff40e47666413.tar.gz vaultwarden-e7d5c17ff7943cae63ed57e07e1ff40e47666413.zip |
Fix mail::send_incomplete_2fa_login panic issue (#4792)
- fixes https://github.com/dani-garcia/vaultwarden/issues/4528
-rw-r--r-- | src/api/core/two_factor/mod.rs | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/api/core/two_factor/mod.rs b/src/api/core/two_factor/mod.rs index 2dd88a64..86443a5e 100644 --- a/src/api/core/two_factor/mod.rs +++ b/src/api/core/two_factor/mod.rs @@ -269,10 +269,18 @@ pub async fn send_incomplete_2fa_notifications(pool: DbPool) { "User {} did not complete a 2FA login within the configured time limit. IP: {}", user.email, login.ip_address ); - mail::send_incomplete_2fa_login(&user.email, &login.ip_address, &login.login_time, &login.device_name) + match mail::send_incomplete_2fa_login(&user.email, &login.ip_address, &login.login_time, &login.device_name) .await - .expect("Error sending incomplete 2FA email"); - login.delete(&mut conn).await.expect("Error deleting incomplete 2FA record"); + { + Ok(_) => { + if let Err(e) = login.delete(&mut conn).await { + error!("Error deleting incomplete 2FA record: {e:#?}"); + } + } + Err(e) => { + error!("Error sending incomplete 2FA email: {e:#?}"); + } + } } } |