From 44c556f2ff02f8ce6bb38d5e78b7966b38d0ad10 Mon Sep 17 00:00:00 2001 From: setsecurity Date: Mon, 24 Mar 2025 21:51:55 +0100 Subject: [PATCH] Update email.rs Add ip_src on logs when email 2fa token is invalid or not available Changes for fail2ban purposes --- src/api/core/two_factor/email.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/api/core/two_factor/email.rs b/src/api/core/two_factor/email.rs index d6470a28..99762920 100644 --- a/src/api/core/two_factor/email.rs +++ b/src/api/core/two_factor/email.rs @@ -204,7 +204,7 @@ pub async fn validate_email_code_str(user_id: &UserId, token: &str, data: &str, .map_res("Two factor not found")?; let Some(issued_token) = &email_data.last_token else { err!( - "No token available", + format!("No token available! Server time: {} IP: {}", current_time.format("%F %T UTC"), ip.ip), ErrorEvent { event: EventType::UserFailedLogIn2fa } @@ -220,7 +220,7 @@ pub async fn validate_email_code_str(user_id: &UserId, token: &str, data: &str, twofactor.save(conn).await?; err!( - "Token is invalid", + format!("Token is invalid! Server time: {} IP: {}", current_time.format("%F %T UTC"), ip.ip), ErrorEvent { event: EventType::UserFailedLogIn2fa }