use wcf\system\application\ApplicationHandler;
use wcf\system\cache\runtime\UserProfileRuntimeCache;
use wcf\system\exception\IllegalLinkException;
+use wcf\system\exception\NamedUserException;
use wcf\system\exception\PermissionDeniedException;
use wcf\system\form\builder\TemplateFormNode;
use wcf\system\request\LinkHandler;
$this->user = WCF::getSession()->getPendingUserChange();
if (!$this->user) {
- throw new PermissionDeniedException();
+ throw new NamedUserException(WCF::getLanguage()->getDynamicVariable(
+ 'wcf.user.security.multifactor.authentication.noPendingUserChange'
+ ));
}
$this->setups = Setup::getAllForUser($this->user);
*/
private $xsrfToken;
- private const ACP_SESSION_LIFETIME = 7200;
- private const GUEST_SESSION_LIFETIME = 7200;
- private const USER_SESSION_LIFETIME = 86400 * 14;
+ private const ACP_SESSION_LIFETIME = 2 * 3600;
+ private const GUEST_SESSION_LIFETIME = 2 * 3600;
+ private const USER_SESSION_LIFETIME = 14 * 86400;
private const CHANGE_USER_AFTER_MULTIFACTOR_KEY = '__changeUserAfterMultifactor__';
+ private const PENDING_USER_LIFETIME = 15 * 60;
/**
* Provides access to session data.
*/
public function changeUserAfterMultifactor(User $user): bool {
if ($user->multifactorActive) {
- $this->register(self::CHANGE_USER_AFTER_MULTIFACTOR_KEY, $user->userID);
+ $this->register(self::CHANGE_USER_AFTER_MULTIFACTOR_KEY, [
+ 'userId' => $user->userID,
+ 'expires' => TIME_NOW + self::PENDING_USER_LIFETIME,
+ ]);
$this->setLanguageID($user->languageID);
return true;
* Returns the pending user change initiated by changeUserAfterMultifactor().
*/
public function getPendingUserChange(): ?User {
- $userId = $this->getVar(self::CHANGE_USER_AFTER_MULTIFACTOR_KEY);
- if (!$userId) {
+ $data = $this->getVar(self::CHANGE_USER_AFTER_MULTIFACTOR_KEY);
+ if (!$data) {
+ return null;
+ }
+
+ $userId = $data['userId'];
+ $expires = $data['expires'];
+
+ if ($expires < TIME_NOW) {
return null;
}
{if LANGUAGE_USE_INFORMAL_VARIANT}Du hast{else}Sie haben{/if} die Mehrfaktor-Authentifizierung mit dem Verfahren „{lang}wcf.user.security.multifactor.{$method->objectType}{/lang}“ erfolgreich aktiviert. {if LANGUAGE_USE_INFORMAL_VARIANT}Du wirst{else}Sie werden{/if} von nun an bei jedem Login den zusätzlichen Faktor benötigen.
{if LANGUAGE_USE_INFORMAL_VARIANT}Du hast{else}Sie haben{/if} auch eine Liste von Notfallcodes erhalten, falls der zusätzliche Faktor unbrauchbar werden sollte. **{if LANGUAGE_USE_INFORMAL_VARIANT}Hast du dir{else}Haben Sie sich{/if} die Notfallcodes notiert?** Falls {if LANGUAGE_USE_INFORMAL_VARIANT}du es vergessen hast, kannst du{else}Sie es vergessen haben, können Sie{/if} dies nachholen, indem {if LANGUAGE_USE_INFORMAL_VARIANT}du{else}Sie{/if} in der Verwaltung der Notfallcodes [URL:{link controller='MultifactorManage' object=$backupMethod isEmail=true}{/link}] neue Notfallcodes {if LANGUAGE_USE_INFORMAL_VARIANT}generierst{else}generieren{/if}.]]></item>
+ <item name="wcf.user.security.multifactor.authentication.noPendingUserChange"><![CDATA[Die Mehrfaktor-Authentifizierung wurde nicht rechtzeitig abgeschlossen. Aus Sicherheitsgründen wurde der unvollständige Login-Vorgang abgebrochen. Bitte <a href="{link controller='Login'}{/link}">{if LANGUAGE_USE_INFORMAL_VARIANT}logge dich{else}loggen Sie sich{/if}</a> erneut ein.]]></item>
</category>
<category name="wcf.user.trophy">
<item name="wcf.user.trophy.trophyPoints"><![CDATA[Trophäen]]></item>
You successfully enabled multi-factor authentication using the „{lang}wcf.user.security.multifactor.{$method->objectType}{/lang}“ method. Going forward you will need to have your second factor handy for every login.
You also received a list of emergency codes to use when your second factor becomes unavailable. **Did you store these emergency codes securely?** If you forgot you can do now by generating new codes in the Emergency Code Management [URL:{link controller='MultifactorManage' object=$backupMethod isEmail=true}{/link}].]]></item>
+ <item name="wcf.user.security.multifactor.authentication.noPendingUserChange"><![CDATA[The multi-factor authentication was not completed in time. The incomplete login process was aborted for security reasons. Please <a href="{link controller='Login'}{/link}">Login</a> once again.]]></item>
</category>
<category name="wcf.user.trophy">
<item name="wcf.user.trophy.trophyPoints"><![CDATA[Trophies]]></item>