diff --git a/app/Notifications/Security/UserFailedLoginAttempt.php b/app/Notifications/Security/UserFailedLoginAttempt.php index c4ac85a2c6..618cf3c6d9 100644 --- a/app/Notifications/Security/UserFailedLoginAttempt.php +++ b/app/Notifications/Security/UserFailedLoginAttempt.php @@ -67,9 +67,10 @@ class UserFailedLoginAttempt extends Notification { $settings = ReturnsSettings::getSettings('ntfy', 'user', $notifiable); $message = new Message(); + $ip = Request::ip(); $message->topic($settings['ntfy_topic']); $message->title((string) trans('email.failed_login_subject')); - $message->body((string) trans('email.failed_login_message', ['email' => $this->user->email])); + $message->body((string) trans('email.failed_login_message', ['ip' => $ip, 'email' => $this->user->email])); return $message; } @@ -79,7 +80,8 @@ class UserFailedLoginAttempt extends Notification */ public function toPushover(User $notifiable): PushoverMessage { - return PushoverMessage::create((string) trans('email.failed_login_message', ['email' => $this->user->email])) + $ip = Request::ip(); + return PushoverMessage::create((string) trans('email.failed_login_message', ['ip' => $ip, 'email' => $this->user->email])) ->title((string) trans('email.failed_login_subject')) ; } @@ -89,7 +91,8 @@ class UserFailedLoginAttempt extends Notification */ public function toSlack(User $notifiable): SlackMessage { - $message = (string) trans('email.failed_login_message', ['email' => $this->user->email]); + $ip = Request::ip(); + $message = (string) trans('email.failed_login_message', ['ip' => $ip, 'email' => $this->user->email]); return new SlackMessage()->content($message); } diff --git a/resources/lang/en_US/email.php b/resources/lang/en_US/email.php index 2bdb563656..ddc329f6fd 100644 --- a/resources/lang/en_US/email.php +++ b/resources/lang/en_US/email.php @@ -70,7 +70,7 @@ return [ // known user login attempt 'failed_login_subject' => 'Firefly III detected a failed login attempt', 'failed_login_body' => 'Firefly III detected that somebody (you?) failed to login with your account ":email". Please verify that this was you.', - 'failed_login_message' => 'A failed login attempt on your Firefly III account ":email" was detected.', + 'failed_login_message' => 'A failed login attempt (:ip) on your Firefly III account ":email" was detected.', 'failed_login_warning' => 'If you recognize this IP address or the login attempt, you can ignore this message. If you didn\'t try to login, of if you have no idea what this is about, verify your password security, change it, and log out all other sessions. To do this, go to your profile page. Of course you have 2FA enabled already, right? Stay safe!', // registered