logout() public method

Logs out the user from the current session.
public logout ( $clearIdentity = FALSE ) : void
return void
Exemplo n.º 1
0
 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;
     };
 }
Exemplo n.º 3
0
 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;
         }
     }
 }
Exemplo n.º 4
0
 /**
  * logout action
  * @return void
  */
 public function actionLogout()
 {
     $this->user->logout();
     $this->flashMessage(_("You are succesfully log out"), "success");
     $this->redirect("login");
     return;
 }
Exemplo n.º 5
0
 private function addEventListeners()
 {
     $this->onSuccess[] = function () {
         $this->user->logout();
     };
 }
Exemplo n.º 6
0
 public function handleLogout()
 {
     $this->userContext->logout(true);
 }
Exemplo n.º 7
0
 public function handleSignOut()
 {
     $this->user->logout();
     $this->onLoggedOut();
 }