<ol class="boxMenu">
{foreach from=$setups item='_setup'}
<li{if $setup->getId() == $_setup->getId()} class="active"{/if}>
- <a class="boxMenuLink" href="{link controller='MultifactorAuthentication' object=$_setup}{/link}"><span class="boxMenuLinkTitle">{lang}wcf.user.security.multifactor.{$_setup->getObjectType()->objectType}{/lang}</span></a>
+ <a class="boxMenuLink" href="{link controller='MultifactorAuthentication' object=$_setup url=$redirectUrl}{/link}"><span class="boxMenuLinkTitle">{lang}wcf.user.security.multifactor.{$_setup->getObjectType()->objectType}{/lang}</span></a>
</li>
{/foreach}
</ol>
use wcf\data\object\type\ObjectType;
use wcf\data\user\User;
use wcf\form\AbstractFormBuilderForm;
+use wcf\system\application\ApplicationHandler;
use wcf\system\exception\IllegalLinkException;
use wcf\system\exception\PermissionDeniedException;
use wcf\system\request\LinkHandler;
use wcf\system\user\multifactor\IMultifactorMethod;
use wcf\system\user\multifactor\Setup;
use wcf\system\WCF;
+use wcf\util\HeaderUtil;
/**
* Represents the multi-factor authentication form.
*/
private $setup;
+ /**
+ * @var string
+ */
+ public $redirectUrl;
+
/**
* @inheritDoc
*/
\assert($this->method->getDefinition()->definitionName === 'com.woltlab.wcf.multifactor');
$this->processor = $this->method->getProcessor();
+
+ if (!empty($_GET['url']) && ApplicationHandler::getInstance()->isInternalURL($_GET['url'])) {
+ $this->redirectUrl = $_GET['url'];
+ }
}
/**
public function saved() {
AbstractForm::saved();
- $this->form->cleanup();
- $this->buildForm();
-
- // TODO: Proper success message and hiding of the form.
- $this->form->showSuccessMessage(true);
+ if ($this->redirectUrl) {
+ HeaderUtil::redirect($this->redirectUrl);
+ }
+ else {
+ HeaderUtil::redirect(LinkHandler::getInstance()->getLink());
+ }
+ exit;
}
/**
protected function setFormAction() {
$this->form->action(LinkHandler::getInstance()->getControllerLink(static::class, [
'object' => $this->setup,
+ 'url' => $this->redirectUrl,
]));
}
'setups' => $this->setups,
'user' => $this->user,
'setup' => $this->setup,
+ 'redirectUrl' => $this->redirectUrl,
]);
}
}