From 66dcf7319ec2f96811d7ae73fa78c88d19ad1d00 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Thu, 21 Jan 2021 12:24:15 +0100 Subject: [PATCH] Add logout and change user hint to Reauthentication in ACP --- .../templates/__reauthenticationLoginAs.tpl | 5 +++- .../lib/acp/action/FullLogoutAction.class.php | 30 +++++++++++++++++++ .../lib/acp/action/LogoutAction.class.php | 3 +- .../files/lib/action/LogoutAction.class.php | 1 - .../install/files/lib/system/WCFACP.class.php | 2 +- wcfsetup/install/lang/de.xml | 1 + wcfsetup/install/lang/en.xml | 1 + 7 files changed, 38 insertions(+), 5 deletions(-) create mode 100644 wcfsetup/install/files/lib/acp/action/FullLogoutAction.class.php diff --git a/wcfsetup/install/files/acp/templates/__reauthenticationLoginAs.tpl b/wcfsetup/install/files/acp/templates/__reauthenticationLoginAs.tpl index e4e29a800b..2072f2c749 100644 --- a/wcfsetup/install/files/acp/templates/__reauthenticationLoginAs.tpl +++ b/wcfsetup/install/files/acp/templates/__reauthenticationLoginAs.tpl @@ -1,4 +1,7 @@
{lang}wcf.user.reauthentication.loginAs{/lang}
-
{$__wcf->user->username}
+
+ {$__wcf->user->username} + {lang}wcf.user.reauthentication.logoutAndChangeUser{/lang} +
diff --git a/wcfsetup/install/files/lib/acp/action/FullLogoutAction.class.php b/wcfsetup/install/files/lib/acp/action/FullLogoutAction.class.php new file mode 100644 index 0000000000..e6b3249b1c --- /dev/null +++ b/wcfsetup/install/files/lib/acp/action/FullLogoutAction.class.php @@ -0,0 +1,30 @@ + + * @package WoltLabSuite\Core\Acp\Action + */ +class FullLogoutAction extends LogoutAction { + /** + * @inheritDoc + */ + public function execute() { + AbstractSecureAction::execute(); + + WCF::getSession()->delete(); + + $this->executed(); + + HeaderUtil::redirect(LinkHandler::getInstance()->getLink()); + exit; + } +} diff --git a/wcfsetup/install/files/lib/acp/action/LogoutAction.class.php b/wcfsetup/install/files/lib/acp/action/LogoutAction.class.php index 060de11d17..88cdaa7a3d 100755 --- a/wcfsetup/install/files/lib/acp/action/LogoutAction.class.php +++ b/wcfsetup/install/files/lib/acp/action/LogoutAction.class.php @@ -6,7 +6,7 @@ use wcf\system\WCF; use wcf\util\HeaderUtil; /** - * Does the user logout in the admin control panel. + * Does the user logout in the admin control panel (clearing reauthentication). * * @author Tim Duesterhus, Marcel Werk * @copyright 2001-2021 WoltLab GmbH @@ -25,7 +25,6 @@ class LogoutAction extends AbstractSecureAction { public function execute() { parent::execute(); - // do logout WCF::getSession()->clearReauthentication(); $this->executed(); diff --git a/wcfsetup/install/files/lib/action/LogoutAction.class.php b/wcfsetup/install/files/lib/action/LogoutAction.class.php index 3a10af9d62..fad00add45 100644 --- a/wcfsetup/install/files/lib/action/LogoutAction.class.php +++ b/wcfsetup/install/files/lib/action/LogoutAction.class.php @@ -21,7 +21,6 @@ class LogoutAction extends \wcf\acp\action\LogoutAction { public function execute() { AbstractSecureAction::execute(); - // do logout WCF::getSession()->delete(); // remove cookies diff --git a/wcfsetup/install/files/lib/system/WCFACP.class.php b/wcfsetup/install/files/lib/system/WCFACP.class.php index 3af200bed2..7b7d69f94a 100644 --- a/wcfsetup/install/files/lib/system/WCFACP.class.php +++ b/wcfsetup/install/files/lib/system/WCFACP.class.php @@ -138,7 +138,7 @@ class WCFACP extends WCF { exit; } } - else if (empty($pathInfo) || !preg_match('~^/?(login|logout|multifactor-authentication|reauthentication)/~i', $pathInfo)) { + else if (empty($pathInfo) || !preg_match('~^/?(login|(full-)?logout|multifactor-authentication|reauthentication)/~i', $pathInfo)) { if (WCF::getUser()->userID == 0) { // work-around for AJAX-requests within ACP if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') { diff --git a/wcfsetup/install/lang/de.xml b/wcfsetup/install/lang/de.xml index a7d8f02678..0fc557371f 100644 --- a/wcfsetup/install/lang/de.xml +++ b/wcfsetup/install/lang/de.xml @@ -4759,6 +4759,7 @@ sich{/if} nicht bei uns registriert {if LANGUAGE_USE_INFORMAL_VARIANT}hast{else} + user->username}? Abmelden und Benutzer wechseln.]]> diff --git a/wcfsetup/install/lang/en.xml b/wcfsetup/install/lang/en.xml index ba97cc780f..ec49be1bf3 100644 --- a/wcfsetup/install/lang/en.xml +++ b/wcfsetup/install/lang/en.xml @@ -4757,6 +4757,7 @@ not register with us.]]> + user->username}? Logout and change user.]]> -- 2.20.1