From: Tim Düsterhus Date: Tue, 1 Dec 2020 14:48:12 +0000 (+0100) Subject: Add TReauthenticationCheck X-Git-Tag: 5.4.0_Alpha_1~555^2~6^2~4 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=dd038ef42b3a61129505a5cf3c3326b8138c8cdf;p=GitHub%2FWoltLab%2FWCF.git Add TReauthenticationCheck --- 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; + } + } +}