From dd038ef42b3a61129505a5cf3c3326b8138c8cdf Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Tue, 1 Dec 2020 15:48:12 +0100 Subject: [PATCH] Add TReauthenticationCheck --- .../TReauthenticationCheck.class.php | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 wcfsetup/install/files/lib/system/user/authentication/TReauthenticationCheck.class.php diff --git a/wcfsetup/install/files/lib/system/user/authentication/TReauthenticationCheck.class.php b/wcfsetup/install/files/lib/system/user/authentication/TReauthenticationCheck.class.php new file mode 100644 index 0000000000..ef63bbafc2 --- /dev/null +++ b/wcfsetup/install/files/lib/system/user/authentication/TReauthenticationCheck.class.php @@ -0,0 +1,32 @@ + + * @package WoltLabSuite\Core\System\User\Authentication + * @since 5.4 + */ +trait TReauthenticationCheck { + /** + * If the current user is in the need for a reauthentication a redirect to + * ReauthenticationForm is performed. After successful reauthentication the + * user will return to the URL given as `$returnTo`. + */ + private function requestReauthentication(string $returnTo): void { + if (WCF::getSession()->needsReauthentication()) { + HeaderUtil::redirect( + LinkHandler::getInstance()->getLink('Reauthentication', [ + 'url' => $returnTo, + ]) + ); + exit; + } + } +} -- 2.20.1