From e9163b4bd25182a8ae55b5551c8e7524715de53e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=A9=20Costa?= Date: Tue, 11 Jun 2024 10:22:38 +0200 Subject: [PATCH] feat(Session): provide `authenticated_at` programmatically --- library/Notifications/ProvidedHook/SessionStorage.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/library/Notifications/ProvidedHook/SessionStorage.php b/library/Notifications/ProvidedHook/SessionStorage.php index 3f018e32..87164fe4 100644 --- a/library/Notifications/ProvidedHook/SessionStorage.php +++ b/library/Notifications/ProvidedHook/SessionStorage.php @@ -4,6 +4,7 @@ namespace Icinga\Module\Notifications\ProvidedHook; +use DateTime; use Icinga\Application\Hook\AuthenticationHook; use Icinga\Application\Logger; use Icinga\Module\Notifications\Common\Database; @@ -90,9 +91,10 @@ public function onLogin(User $user): void $this->database->insert( 'browser_session', [ - 'php_session_id' => $this->session->getId(), - 'username' => trim($user->getUsername()), - 'user_agent' => $userAgent + 'php_session_id' => $this->session->getId(), + 'username' => trim($user->getUsername()), + 'user_agent' => $userAgent, + 'authenticated_at' => (new DateTime())->format('Uv') ] ); $this->database->commitTransaction();