Fix that logout of unauthenticated users throws exceptions
This commit is contained in:
parent
ebde422824
commit
266936b9b5
|
@ -142,14 +142,16 @@ class AuthenticationController extends ActionController
|
||||||
public function logoutAction()
|
public function logoutAction()
|
||||||
{
|
{
|
||||||
$auth = $this->Auth();
|
$auth = $this->Auth();
|
||||||
|
if (! $auth->isAuthenticated()) {
|
||||||
|
$this->redirectToLogin();
|
||||||
|
}
|
||||||
$isRemoteUser = $auth->getUser()->isRemoteUser();
|
$isRemoteUser = $auth->getUser()->isRemoteUser();
|
||||||
$auth->removeAuthorization();
|
$auth->removeAuthorization();
|
||||||
|
|
||||||
if ($isRemoteUser === true) {
|
if ($isRemoteUser === true) {
|
||||||
$this->_helper->layout->setLayout('login');
|
$this->_helper->layout->setLayout('login');
|
||||||
$this->_response->setHttpResponseCode(401);
|
$this->_response->setHttpResponseCode(401);
|
||||||
} else {
|
} else {
|
||||||
$this->rerenderLayout()->redirectToLogin();
|
$this->redirectToLogin();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue