Commit 6defeb4a authored by Helmut Hummel's avatar Helmut Hummel Committed by Frank Nägler
Browse files

[BUGFIX] Do not log out a logged out user

It can happen that the logout action of the logout
controller is called without a user being logged in.

To avoid a fatal error, we do not call the logoff
code any more and just do the redirect handling.

Releases: master, 6.2
Resolves: #68220
Change-Id: I06f6289d01c681d4b412910ded8e9894f377892d
Reviewed-on: http://review.typo3.org/41460


Reviewed-by: Andreas Fernandez's avatarAndreas Fernandez <typo3@scripting-base.de>
Reviewed-by: default avatarSusanne Moog <typo3@susannemoog.de>
Tested-by: default avatarSusanne Moog <typo3@susannemoog.de>
Reviewed-by: default avatarMarkus Sommer <markussom@posteo.de>
Tested-by: default avatarMarkus Sommer <markussom@posteo.de>
Reviewed-by: Frank Nägler's avatarFrank Nägler <frank.naegler@typo3.org>
Tested-by: Frank Nägler's avatarFrank Nägler <frank.naegler@typo3.org>
parent ff4a6a69
......@@ -30,12 +30,14 @@ class LogoutController {
* @return void
*/
public function logout() {
// Logout written to log
$this->getBackendUser()->writelog(255, 2, 0, 1, 'User %s logged out from TYPO3 Backend', array($this->getBackendUser()->user['username']));
/** @var \TYPO3\CMS\Core\FormProtection\BackendFormProtection $backendFormProtection */
$backendFormProtection = FormProtectionFactory::get();
$backendFormProtection->removeSessionTokenFromRegistry();
$this->getBackendUser()->logoff();
if (!empty($this->getBackendUser()->user['username'])) {
// Logout written to log
$this->getBackendUser()->writelog(255, 2, 0, 1, 'User %s logged out from TYPO3 Backend', array($this->getBackendUser()->user['username']));
/** @var \TYPO3\CMS\Core\FormProtection\BackendFormProtection $backendFormProtection */
$backendFormProtection = FormProtectionFactory::get();
$backendFormProtection->removeSessionTokenFromRegistry();
$this->getBackendUser()->logoff();
}
$redirect = GeneralUtility::sanitizeLocalUrl(GeneralUtility::_GP('redirect'));
$redirectUrl = $redirect ? $redirect : 'index.php';
HttpUtility::redirect($redirectUrl);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment