From 54394bee6d5984ae5ae465d1ac15fa8a52a8b62d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Mon, 9 Nov 2020 13:32:07 +0100 Subject: [PATCH] Add default device name for TOTP --- .../system/user/multifactor/TotpMultifactorMethod.class.php | 3 ++- wcfsetup/install/lang/de.xml | 1 + wcfsetup/install/lang/en.xml | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/wcfsetup/install/files/lib/system/user/multifactor/TotpMultifactorMethod.class.php b/wcfsetup/install/files/lib/system/user/multifactor/TotpMultifactorMethod.class.php index d350251662..76df9b4d9b 100644 --- a/wcfsetup/install/files/lib/system/user/multifactor/TotpMultifactorMethod.class.php +++ b/wcfsetup/install/files/lib/system/user/multifactor/TotpMultifactorMethod.class.php @@ -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, diff --git a/wcfsetup/install/lang/de.xml b/wcfsetup/install/lang/de.xml index 79e9e3773d..b16802f0be 100644 --- a/wcfsetup/install/lang/de.xml +++ b/wcfsetup/install/lang/de.xml @@ -4856,6 +4856,7 @@ Die E-Mail-Adresse des neuen Benutzers lautet: {@$user->email} + diff --git a/wcfsetup/install/lang/en.xml b/wcfsetup/install/lang/en.xml index 88463d036a..672518ed4f 100644 --- a/wcfsetup/install/lang/en.xml +++ b/wcfsetup/install/lang/en.xml @@ -4853,6 +4853,7 @@ Open the link below to access the user profile: + -- 2.20.1