From: Tim Düsterhus Date: Tue, 1 Dec 2020 14:41:12 +0000 (+0100) Subject: Add ReauthenticationForm X-Git-Tag: 5.4.0_Alpha_1~555^2~6^2~5 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=68ee7d3bb4cbecc079441c6ca6d179cfeef78684;p=GitHub%2FWoltLab%2FWCF.git Add ReauthenticationForm --- diff --git a/com.woltlab.wcf/page.xml b/com.woltlab.wcf/page.xml index 7f7d66e625..36d384576a 100644 --- a/com.woltlab.wcf/page.xml +++ b/com.woltlab.wcf/page.xml @@ -866,6 +866,21 @@ E-Mail: [E-Mail-Adresse der verantwortlichen Stelle]


Verantwort Mehrfaktor-Authentifizierung deaktivieren + + system + wcf\form\ReauthenticationForm + Re-authentication + Erneute Authentifizierung + 1 + 1 + 1 + + Re-authentication + + + Erneute Authentifizierung + + diff --git a/com.woltlab.wcf/templates/reauthentication.tpl b/com.woltlab.wcf/templates/reauthentication.tpl new file mode 100644 index 0000000000..02b1ef733d --- /dev/null +++ b/com.woltlab.wcf/templates/reauthentication.tpl @@ -0,0 +1,5 @@ +{include file='header' __disableAds=true} + +{@$form->getHtml()} + +{include file='footer' __disableAds=true} diff --git a/wcfsetup/install/files/acp/templates/reauthentication.tpl b/wcfsetup/install/files/acp/templates/reauthentication.tpl new file mode 100644 index 0000000000..4a682a73b0 --- /dev/null +++ b/wcfsetup/install/files/acp/templates/reauthentication.tpl @@ -0,0 +1,11 @@ +{include file='header' pageTitle='wcf.user.reauthentication'} + +

+
+

{lang}wcf.user.reauthentication{/lang}

+
+
+ +{@$form->getHtml()} + +{include file='footer'} diff --git a/wcfsetup/install/files/lib/acp/form/ReauthenticationForm.class.php b/wcfsetup/install/files/lib/acp/form/ReauthenticationForm.class.php new file mode 100644 index 0000000000..7670471ad7 --- /dev/null +++ b/wcfsetup/install/files/lib/acp/form/ReauthenticationForm.class.php @@ -0,0 +1,15 @@ + + * @package WoltLabSuite\Core\Acp\Form + * @since 5.4 + */ +class ReauthenticationForm extends \wcf\form\ReauthenticationForm { + +} diff --git a/wcfsetup/install/files/lib/form/ReauthenticationForm.class.php b/wcfsetup/install/files/lib/form/ReauthenticationForm.class.php new file mode 100644 index 0000000000..2de11450e4 --- /dev/null +++ b/wcfsetup/install/files/lib/form/ReauthenticationForm.class.php @@ -0,0 +1,110 @@ + + * @package WoltLabSuite\Core\Form + * @since 5.4 + */ +class ReauthenticationForm extends AbstractFormBuilderForm { + const AVAILABLE_DURING_OFFLINE_MODE = true; + + /** + * @inheritDoc + */ + public $formAction = 'authenticate'; + + /** + * @var string + */ + public $redirectUrl; + + /** + * @inheritDoc + */ + public function readParameters() { + parent::readParameters(); + + if (!empty($_GET['url']) && ApplicationHandler::getInstance()->isInternalURL($_GET['url'])) { + $this->redirectUrl = $_GET['url']; + } + else { + throw new IllegalLinkException(); + } + + if (!WCF::getSession()->needsReauthentication()) { + $this->performRedirect(); + } + } + + /** + * @inheritDoc + */ + protected function createForm() { + parent::createForm(); + + $this->form->appendChild( + UserPasswordField::create() + ->required(), + ); + } + + /** + * @inheritDoc + */ + public function save() { + AbstractForm::save(); + + WCF::getSession()->registerReauthentication(); + + $this->saved(); + } + + /** + * @inheritDoc + */ + public function saved() { + AbstractForm::saved(); + + $this->performRedirect(); + } + + /** + * Returns to the redirectUrl. + */ + protected function performRedirect() { + HeaderUtil::redirect($this->redirectUrl); + exit; + } + + /** + * @inheritDoc + */ + protected function setFormAction() { + $this->form->action(LinkHandler::getInstance()->getControllerLink(static::class, [ + 'url' => $this->redirectUrl, + ])); + } + + /** + * @inheritDoc + */ + public function assignVariables() { + parent::assignVariables(); + + WCF::getTPL()->assign([ + 'redirectUrl' => $this->redirectUrl, + ]); + } +} diff --git a/wcfsetup/install/lang/de.xml b/wcfsetup/install/lang/de.xml index 6c455cbeaa..f46ae2e503 100644 --- a/wcfsetup/install/lang/de.xml +++ b/wcfsetup/install/lang/de.xml @@ -4746,6 +4746,7 @@ sich{/if} nicht bei uns registriert {if LANGUAGE_USE_INFORMAL_VARIANT}hast{else} getBlacklistMatchesTitle() item=matchLabel}{$matchLabel}{/implode}).]]> + diff --git a/wcfsetup/install/lang/en.xml b/wcfsetup/install/lang/en.xml index aa84ca6fb3..e2e45e7190 100644 --- a/wcfsetup/install/lang/en.xml +++ b/wcfsetup/install/lang/en.xml @@ -4744,6 +4744,7 @@ not register with us.]]> getBlacklistMatchesTitle() item=matchLabel}{$matchLabel}{/implode}).]]> +