當前位置: 首頁>>代碼示例>>PHP>>正文


PHP User::logout方法代碼示例

本文整理匯總了PHP中Nette\Security\User::logout方法的典型用法代碼示例。如果您正苦於以下問題:PHP User::logout方法的具體用法?PHP User::logout怎麽用?PHP User::logout使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Nette\Security\User的用法示例。


在下文中一共展示了User::logout方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: onSuccessLoginForm

 public function onSuccessLoginForm()
 {
     if ($this->user->isLoggedIn()) {
         $this->user->logout(true);
     } else {
         $this->user->login($this->identity);
     }
     $this->redirect("this");
 }
開發者ID:bauer01,項目名稱:fake-login,代碼行數:9,代碼來源:Panel.php

示例2: __construct

 /**
  * @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;
     };
 }
開發者ID:lookyman,項目名稱:nette-oauth2-server,代碼行數:17,代碼來源:UserRepository.php

示例3: checkIdentityAction

 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;
         }
     }
 }
開發者ID:trejjam,項目名稱:authorization,代碼行數:28,代碼來源:User.php

示例4: actionLogout

 /**
  * logout action
  * @return void
  */
 public function actionLogout()
 {
     $this->user->logout();
     $this->flashMessage(_("You are succesfully log out"), "success");
     $this->redirect("login");
     return;
 }
開發者ID:OCC2,項目名稱:occ2pacs,代碼行數:11,代碼來源:AuthenticatorPresenter.php

示例5: addEventListeners

 private function addEventListeners()
 {
     $this->onSuccess[] = function () {
         $this->user->logout();
     };
 }
開發者ID:shophp,項目名稱:shophp,代碼行數:6,代碼來源:LogoutForm.php

示例6: handleLogout

 public function handleLogout()
 {
     $this->userContext->logout(true);
 }
開發者ID:Achse,項目名稱:petrhejna,代碼行數:4,代碼來源:LoginControl.php

示例7: handleSignOut

 public function handleSignOut()
 {
     $this->user->logout();
     $this->onLoggedOut();
 }
開發者ID:chapcz,項目名稱:Admin,代碼行數:5,代碼來源:AdminControl.php


注:本文中的Nette\Security\User::logout方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。