From ccc27587865e88d213a599d9b597b0a49029c88e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Thu, 3 Dec 2020 09:56:15 +0100 Subject: [PATCH] Use more user-friendly error message for MFA w/o setups This still MUST NOT ever happen, but in case it does the error message is more useful and it was easy enough to implement. --- .../files/lib/form/MultifactorAuthenticationForm.class.php | 7 ++++++- wcfsetup/install/lang/de.xml | 1 + wcfsetup/install/lang/en.xml | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/wcfsetup/install/files/lib/form/MultifactorAuthenticationForm.class.php b/wcfsetup/install/files/lib/form/MultifactorAuthenticationForm.class.php index 0954afec8a..c6ec9a93e4 100644 --- a/wcfsetup/install/files/lib/form/MultifactorAuthenticationForm.class.php +++ b/wcfsetup/install/files/lib/form/MultifactorAuthenticationForm.class.php @@ -86,7 +86,12 @@ class MultifactorAuthenticationForm extends AbstractFormBuilderForm { $this->setups = Setup::getAllForUser($this->user); if (empty($this->setups)) { - throw new \LogicException('Unreachable'); + throw new NamedUserException(WCF::getLanguage()->getDynamicVariable( + 'wcf.user.security.multifactor.authentication.noSetup', + [ + 'user' => $this->user, + ] + )); } \uasort($this->setups, function (Setup $a, Setup $b) { diff --git a/wcfsetup/install/lang/de.xml b/wcfsetup/install/lang/de.xml index 914150327e..864ce3379d 100644 --- a/wcfsetup/install/lang/de.xml +++ b/wcfsetup/install/lang/de.xml @@ -4946,6 +4946,7 @@ Die E-Mail-Adresse des neuen Benutzers lautet: {@$user->email} {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}.]]> {if LANGUAGE_USE_INFORMAL_VARIANT}logge dich{else}loggen Sie sich{/if} erneut ein.]]> + {$user->username} ist mit der Mehrfaktor-Authentifizierung geschützt, es sind jedoch keine aktiven Verfahren verfügbar. Bitte {if LANGUAGE_USE_INFORMAL_VARIANT}wende dich{else}wenden Sie sich{/if} an den Administrator.]]> diff --git a/wcfsetup/install/lang/en.xml b/wcfsetup/install/lang/en.xml index bb9fda89aa..5f9e62f0e9 100644 --- a/wcfsetup/install/lang/en.xml +++ b/wcfsetup/install/lang/en.xml @@ -4943,6 +4943,7 @@ You successfully enabled multi-factor authentication using the „{lang}wcf.user 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}].]]> Login once again.]]> + {$user->username} is protected by multi-factor authentication, but no methods are set up. Please contact the administrator for support.]]> -- 2.20.1