Create a new DB user when somebody logs in using SAML

This commit is contained in:
Jan Böhmer 2023-02-20 23:04:20 +01:00
parent c0b74d83a5
commit 78ec0f1ea3
6 changed files with 75 additions and 18 deletions

View file

@ -57,10 +57,11 @@ final class LoginSuccessSubscriber implements EventSubscriberInterface
$ip = $event->getRequest()->getClientIp();
$log = new UserLoginLogEntry($ip, $this->gpdr_compliance);
$user = $event->getAuthenticationToken()->getUser();
if ($user instanceof User) {
if ($user instanceof User && $user->getID()) {
$log->setTargetElement($user);
$this->eventLogger->logAndFlush($log);
}
$this->eventLogger->logAndFlush($log);
$this->flashBag->add('notice', $this->translator->trans('flash.login_successful'));
}