本文整理匯總了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");
}
示例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;
};
}
示例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;
}
}
}
示例4: actionLogout
/**
* logout action
* @return void
*/
public function actionLogout()
{
$this->user->logout();
$this->flashMessage(_("You are succesfully log out"), "success");
$this->redirect("login");
return;
}
示例5: addEventListeners
private function addEventListeners()
{
$this->onSuccess[] = function () {
$this->user->logout();
};
}
示例6: handleLogout
public function handleLogout()
{
$this->userContext->logout(true);
}
示例7: handleSignOut
public function handleSignOut()
{
$this->user->logout();
$this->onLoggedOut();
}