Skip to content

Commit

Permalink
Merge pull request #3074 from matesko/patch-1
Browse files Browse the repository at this point in the history
Update AuthSubscriber.php to prevent logout error
  • Loading branch information
bobdenotter authored Feb 7, 2022
2 parents 02b828c + 7f694b9 commit c3c3470
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Event/Subscriber/AuthSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ public function onAuthenticationSuccess(AuthenticationSuccessEvent $event): void
/** @var User $user */
$user = $event->getAuthenticationToken()->getUser();
$request = $this->requestStack->getCurrentRequest();

$user->setLastseenAt(new \DateTime());
$user->setLastIp($request->getClientIp());
/** @var Parser $uaParser */
Expand All @@ -53,6 +52,10 @@ public function onAuthenticationSuccess(AuthenticationSuccessEvent $event): void

public function onLogout(LogoutEvent $event): void
{
if (is_null($event->getToken())) {
return;
}

/** @var User $user */
$user = $event->getToken()->getUser();

Expand Down

0 comments on commit c3c3470

Please sign in to comment.