From 3598a32ecfc9b88f443e7128f75d115281aa5927 Mon Sep 17 00:00:00 2001 From: Miguel N Date: Tue, 8 Sep 2020 01:37:33 +0100 Subject: [PATCH] Added existing account check to logs --- app/Listeners/LogAuthenticationFailure.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/Listeners/LogAuthenticationFailure.php b/app/Listeners/LogAuthenticationFailure.php index 3ce94c7..4286928 100644 --- a/app/Listeners/LogAuthenticationFailure.php +++ b/app/Listeners/LogAuthenticationFailure.php @@ -26,8 +26,16 @@ class LogAuthenticationFailure */ public function handle($event) { + $targetAccountID = 0; + + if (isset($event->user->id)) + { + $targetAccountID = $event->user->id; + } + Log::alert('SECURITY (login): Detected failed authentication attempt!', [ - 'targetAccountID' => $event->user->id ?? '(nonexistent user)', + 'targetAccountID' => $targetAccountID, + 'existingAccount' => ($targetAccountID == 0) ? false : true, 'sourceIP' => request()->ip(), 'matchesAccountLastIP' => request()->ip() == $event->user->originalIP, 'sourceUserAgent' => request()->userAgent(),