public function onSuccessLoginForm() { if ($this->user->isLoggedIn()) { $this->user->logout(true); } else { $this->user->login($this->identity); } $this->redirect("this"); }
/** * @param User $user * @param callable|null $credentialsValidator */ public function __construct(User $user, callable $credentialsValidator = null) { $this->user = $user; $this->credentialsValidator = $credentialsValidator ?: function () { $this->user->logout(true); try { $this->user->login(...func_get_args()); } catch (\Exception $e) { } // Fail silently return $this->user->isLoggedIn() ? new UserEntity($this->user->getId()) : null; }; }
protected function checkIdentityAction() { if ($this->storage->isAuthenticated()) { $identity = $this->storage->getIdentity(); $action = $this->identityHash->getHashAction(is_null($identity) ? $identity : $identity->hash); if (is_null($action)) { parent::logout(); } switch ($action) { case IdentityHash::ACTION_RELOAD: try { $this->login($this->getId(), NULL); } catch (Trejjam\Authorization\User\ManagerException $e) { $this->logout(); } catch (Trejjam\Authorization\User\AuthenticatorException $e) { //this may not happen throw $e; } break; case IdentityHash::ACTION_LOGOUT: $this->logout(); break; case IdentityHash::ACTION_DESTROYED: $this->logout(); break; } } }
/** * logout action * @return void */ public function actionLogout() { $this->user->logout(); $this->flashMessage(_("You are succesfully log out"), "success"); $this->redirect("login"); return; }
private function addEventListeners() { $this->onSuccess[] = function () { $this->user->logout(); }; }
public function handleLogout() { $this->userContext->logout(true); }
public function handleSignOut() { $this->user->logout(); $this->onLoggedOut(); }