Skip to content

Commit

Permalink
Fix mail::send_incomplete_2fa_login panic issue (#4792)
Browse files Browse the repository at this point in the history
- fixes #4528
  • Loading branch information
dfunkt authored Aug 7, 2024
1 parent a7be8fa commit e7d5c17
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/api/core/two_factor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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:#?}");
}
}
}
}

Expand Down

0 comments on commit e7d5c17

Please sign in to comment.