/** * After Login callback * * @access public * @param AuthSuccessEvent $event */ public function afterLogin(AuthSuccessEvent $event) { $userAgent = $this->request->getUserAgent(); $ipAddress = $this->request->getIpAddress(); $this->userLocking->resetFailedLogin($this->userSession->getUsername()); $this->lastLogin->create($event->getAuthType(), $this->userSession->getId(), $ipAddress, $userAgent); $this->sessionStorage->hasSubtaskInProgress = $this->subtask->hasSubtaskInProgress($this->userSession->getId()); if (isset($this->sessionStorage->hasRememberMe) && $this->sessionStorage->hasRememberMe) { $session = $this->rememberMeSession->create($this->userSession->getId(), $ipAddress, $userAgent); $this->rememberMeCookie->write($session['token'], $session['sequence'], $session['expiration']); } }
/** * After Login callback * * @access public * @param AuthSuccessEvent $event */ public function afterLogin(AuthSuccessEvent $event) { $this->logger->debug('Subscriber executed: ' . __METHOD__); $userAgent = $this->request->getUserAgent(); $ipAddress = $this->request->getIpAddress(); $this->userLocking->resetFailedLogin($this->userSession->getUsername()); $this->lastLogin->create($event->getAuthType(), $this->userSession->getId(), $ipAddress, $userAgent); if ($event->getAuthType() === 'RememberMe') { $this->userSession->validatePostAuthentication(); } if (isset($this->sessionStorage->hasRememberMe) && $this->sessionStorage->hasRememberMe) { $session = $this->rememberMeSession->create($this->userSession->getId(), $ipAddress, $userAgent); $this->rememberMeCookie->write($session['token'], $session['sequence'], $session['expiration']); } }
public function onLoginSuccess(AuthSuccessEvent $event) { if ($event->getAuthType() === 'Google') { $provider = $this->authenticationManager->getProvider($event->getAuthType()); $avatar_url = $provider->getUser()->getAvatarUrl(); $user_id = $this->userSession->getId(); if (!empty($avatar_url)) { $options = array('google_avatar_url' => $avatar_url); if (!$this->userMetadataModel->exists($user_id, 'google_show_avatar')) { $options['google_show_avatar'] = 1; } $this->userMetadataModel->save($user_id, $options); } } }