本文整理汇总了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();
}