Add default device name for TOTP
authorTim Düsterhus <duesterhus@woltlab.com>
Mon, 9 Nov 2020 12:32:07 +0000 (13:32 +0100)
committerTim Düsterhus <duesterhus@woltlab.com>
Mon, 16 Nov 2020 16:29:04 +0000 (17:29 +0100)
wcfsetup/install/files/lib/system/user/multifactor/TotpMultifactorMethod.class.php
wcfsetup/install/lang/de.xml
wcfsetup/install/lang/en.xml

index d35025166272069ab46cc5a7215bdc518c584736..76df9b4d9b913500afb8763cdfaf29a548eb372d 100644 (file)
@@ -141,6 +141,7 @@ class TotpMultifactorMethod implements IMultifactorMethod {
                        }
                }
                else {
+                       $defaultName = WCF::getLanguage()->getDynamicVariable('wcf.user.security.multifactor.totp.deviceName.default');
                        $sql = "INSERT INTO     wcf".WCF_N."_user_multifactor_totp
                                                (setupID, deviceID, deviceName, secret, minCounter, createTime)
                                VALUES          (?, ?, ?, ?, ?, ?)";
@@ -148,7 +149,7 @@ class TotpMultifactorMethod implements IMultifactorMethod {
                        $statement->execute([
                                $setupId,
                                Hex::encode(\random_bytes(16)),
-                               $formData['data']['deviceName'],
+                               $formData['data']['deviceName'] ?: $defaultName,
                                $formData['data']['secret'],
                                $formData['data']['code']['minCounter'],
                                TIME_NOW,
index 79e9e3773d7b4a310782745e180dcafed70649eb..b16802f0be9d5bc88b007108659740d43de6105a 100644 (file)
@@ -4856,6 +4856,7 @@ Die E-Mail-Adresse des neuen Benutzers lautet: {@$user->email}
                <item name="wcf.user.security.multifactor.active"><![CDATA[Aktiv]]></item>
                <item name="wcf.user.security.multifactor.backup.generateCodes"><![CDATA[Codes generieren]]></item>
                <item name="wcf.user.security.multifactor.totp.devices"><![CDATA[Eingerichtete Geräte]]></item>
+               <item name="wcf.user.security.multifactor.totp.deviceName.default"><![CDATA[{TIME_NOW|plainTime}]]></item>
        </category>
        <category name="wcf.user.trophy">
                <item name="wcf.user.trophy.trophyPoints"><![CDATA[Trophäen]]></item>
index 88463d036a303624f92e33ec13206799e097525f..672518ed4f4df539e46a66cc08abec55e49dff64 100644 (file)
@@ -4853,6 +4853,7 @@ Open the link below to access the user profile:
                <item name="wcf.user.security.multifactor.active"><![CDATA[Active]]></item>
                <item name="wcf.user.security.multifactor.backup.generateCodes"><![CDATA[Generate Codes]]></item>
                <item name="wcf.user.security.multifactor.totp.devices"><![CDATA[Set Up Devices]]></item>
+               <item name="wcf.user.security.multifactor.totp.deviceName.default"><![CDATA[{TIME_NOW|plainTime}]]></item>
        </category>
        <category name="wcf.user.trophy">
                <item name="wcf.user.trophy.trophyPoints"><![CDATA[Trophies]]></item>