Add IP to failed login message.

This commit is contained in:
James Cole
2025-04-09 21:26:29 +02:00
parent 337440259f
commit 5ce9f32deb
2 changed files with 9 additions and 5 deletions

View File

@@ -80,9 +80,10 @@ class UnknownUserLoginAttempt extends Notification
{
$settings = ReturnsSettings::getSettings('ntfy', 'owner', null);
$message = new Message();
$ip = Request::ip();
$message->topic($settings['ntfy_topic']);
$message->title((string) trans('email.unknown_user_subject'));
$message->body((string) trans('email.unknown_user_message', ['address' => $this->address]));
$message->body((string) trans('email.unknown_user_message', ['address' => $this->address, 'ip' =>$ip]));
return $message;
}
@@ -92,7 +93,9 @@ class UnknownUserLoginAttempt extends Notification
*/
public function toPushover(OwnerNotifiable $notifiable): PushoverMessage
{
return PushoverMessage::create((string) trans('email.unknown_user_message', ['address' => $this->address]))
$ip = Request::ip();
return PushoverMessage::create((string) trans('email.unknown_user_message', ['address' => $this->address, 'ip' =>$ip]))
->title((string) trans('email.unknown_user_subject'))
;
}
@@ -102,8 +105,9 @@ class UnknownUserLoginAttempt extends Notification
*/
public function toSlack(OwnerNotifiable $notifiable): SlackMessage
{
$ip = Request::ip();
return new SlackMessage()->content(
(string) trans('email.unknown_user_body', ['address' => $this->address])
(string) trans('email.unknown_user_body', ['address' => $this->address, 'ip' => $ip])
);
}

View File

@@ -64,8 +64,8 @@ return [
// unknown user login attempt
'unknown_user_subject' => 'An unknown user tried to log in',
'unknown_user_body' => 'An unknown user tried to log in to Firefly III. The email address they used was ":address".',
'unknown_user_message' => 'The email address they used was ":address".',
'unknown_user_body' => 'An unknown user (:ip) tried to log in to Firefly III. The email address they used was ":address".',
'unknown_user_message' => 'The email address they (:ip) used was ":address".',
// known user login attempt
'failed_login_subject' => 'Firefly III detected a failed login attempt',