Skip to content

Commit

Permalink
feat(Session): provide authenticated_at programmatically
Browse files Browse the repository at this point in the history
  • Loading branch information
ncosta-ic authored and nilmerg committed Jun 12, 2024
1 parent 0028789 commit e9163b4
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions library/Notifications/ProvidedHook/SessionStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit e9163b4

Please sign in to comment.