From e4b70c2af1ca7102e29463e4a0af00b66c89f4fc Mon Sep 17 00:00:00 2001 From: the-djmaze <> Date: Mon, 28 Feb 2022 15:31:21 +0100 Subject: [PATCH] Cleanup two-factor-auth extension --- .../js/TwoFactorAuthSettings.js | 38 ++----------------- plugins/two-factor-auth/langs/de_DE.ini | 1 - plugins/two-factor-auth/langs/en.ini | 1 - plugins/two-factor-auth/langs/es_ES.ini | 1 - plugins/two-factor-auth/langs/fr_FR.ini | 1 - plugins/two-factor-auth/langs/hu-HU.ini | 1 - plugins/two-factor-auth/langs/it_IT.ini | 1 - plugins/two-factor-auth/langs/nl_NL.ini | 1 - plugins/two-factor-auth/langs/sv-SE.ini | 1 - plugins/two-factor-auth/langs/zh_CN.ini | 1 - .../templates/TwoFactorAuthSettings.html | 13 +------ 11 files changed, 6 insertions(+), 54 deletions(-) diff --git a/plugins/two-factor-auth/js/TwoFactorAuthSettings.js b/plugins/two-factor-auth/js/TwoFactorAuthSettings.js index 2af8d65f4..8f043fd79 100644 --- a/plugins/two-factor-auth/js/TwoFactorAuthSettings.js +++ b/plugins/two-factor-auth/js/TwoFactorAuthSettings.js @@ -33,8 +33,6 @@ class TwoFactorAuthSettings { constructor() { - this.lock = ko.observable(false); - this.processing = ko.observable(false); this.clearing = ko.observable(false); this.secreting = ko.observable(false); @@ -90,10 +88,6 @@ class TwoFactorAuthSettings this.onShowSecretResult = this.onShowSecretResult.bind(this); } - configureTwoFactor() { -// showScreenPopup(require('View/Popup/TwoFactorConfiguration')); - } - showSecret() { this.secreting(true); rl.pluginRemoteRequest(this.onShowSecretResult, 'ShowTwoFactorSecret'); @@ -110,10 +104,6 @@ class TwoFactorAuthSettings rl.pluginRemoteRequest(this.onResult, 'CreateTwoFactorSecret'); } - logout() { - rl.app.logout(); - } - testTwoFactor() { TwoFactorAuthTestPopupView.showModal([this.twoFactorTested]); } @@ -127,17 +117,10 @@ class TwoFactorAuthSettings rl.pluginRemoteRequest(this.onResult, 'ClearTwoFactorInfo'); } - onShow(bLock) { - this.lock(!!bLock); + onShow() { this.hideSecret(''); } - onHide() { - if (this.lock()) { - location.reload(); - } - } - getQr() { return 'otpauth://totp/' + encodeURIComponent(this.viewUser()) + '?secret=' + encodeURIComponent(this.viewSecret()) @@ -191,12 +174,9 @@ class TwoFactorAuthTestPopupView extends rl.pluginPopupView { this.addObservables({ code: '', codeStatus: null, - testing: false }); - this.koTestedTrigger = null; - ko.decorateCommands(this, { testCodeCommand: self => self.code() && !self.testing() }); @@ -207,25 +187,15 @@ class TwoFactorAuthTestPopupView extends rl.pluginPopupView { Remote.verifyCode(iError => { this.testing(false); this.codeStatus(!iError); - - if (this.koTestedTrigger && this.codeStatus()) { - this.koTestedTrigger(true); - } + this.twoFactorTested(!iError); }, this.code()); } - clearPopup() { + onShow(twoFactorTested) { this.code(''); this.codeStatus(null); this.testing(false); - - this.koTestedTrigger = null; - } - - onShow(koTestedTrigger) { - this.clearPopup(); - - this.koTestedTrigger = koTestedTrigger; + this.twoFactorTested = twoFactorTested; } } diff --git a/plugins/two-factor-auth/langs/de_DE.ini b/plugins/two-factor-auth/langs/de_DE.ini index 51efb50df..9e050e280 100644 --- a/plugins/two-factor-auth/langs/de_DE.ini +++ b/plugins/two-factor-auth/langs/de_DE.ini @@ -10,7 +10,6 @@ BUTTON_ACTIVATE = "Aktivieren" LINK_TEST = "test" BUTTON_SHOW_SECRET = "Geheimnis einblenden" BUTTON_HIDE_SECRET = "Geheminis ausblenden" -TWO_FACTOR_REQUIRE_DESC = "Ihr Benutzerkonto erfordert die Einrichtung der Zwei-Faktor-Authentifizierung." TWO_FACTOR_SECRET_CONFIGURED_DESC = "Konfiguriert" TWO_FACTOR_SECRET_NOT_CONFIGURED_DESC = "Nicht konfiguriert" TWO_FACTOR_SECRET_DESC = "Importieren Sie diese Information in Ihre Google-Authenticator-Anwendung (oder andere TOTP-Anwendung), indem Sie den unten bereitgestellten QR-Code verwenden oder den Code manuell eingeben." diff --git a/plugins/two-factor-auth/langs/en.ini b/plugins/two-factor-auth/langs/en.ini index 1df2de2b2..4133b4fdb 100644 --- a/plugins/two-factor-auth/langs/en.ini +++ b/plugins/two-factor-auth/langs/en.ini @@ -13,7 +13,6 @@ BUTTON_ACTIVATE = "Activate" LINK_TEST = "test" BUTTON_SHOW_SECRET = "Show Secret" BUTTON_HIDE_SECRET = "Hide Secret" -TWO_FACTOR_REQUIRE_DESC = "Your account requires 2-Step verification configuration." TWO_FACTOR_SECRET_CONFIGURED_DESC = "Configured" TWO_FACTOR_SECRET_NOT_CONFIGURED_DESC = "Not configured" TWO_FACTOR_SECRET_DESC = "Import this info into your Google Authenticator client (or other TOTP client) using the provided QR code below or by entering the code manually.\n" diff --git a/plugins/two-factor-auth/langs/es_ES.ini b/plugins/two-factor-auth/langs/es_ES.ini index bbe81bad9..e57238d9d 100644 --- a/plugins/two-factor-auth/langs/es_ES.ini +++ b/plugins/two-factor-auth/langs/es_ES.ini @@ -13,7 +13,6 @@ BUTTON_ACTIVATE = "Activate" LINK_TEST = "probar" BUTTON_SHOW_SECRET = "Mostrar clave secreta" BUTTON_HIDE_SECRET = "Ocultar clave secreta" -TWO_FACTOR_REQUIRE_DESC = "Se requiere que configure la verificación de 2-pasos." TWO_FACTOR_SECRET_CONFIGURED_DESC = "Configurado" TWO_FACTOR_SECRET_NOT_CONFIGURED_DESC = "No configurado" TWO_FACTOR_SECRET_DESC = "Importar esta información en su cliente Google Authenticator (u otro cliente TOTP) utilizando el código QR ​​se indica debajo o introduciendo el código manualmente." diff --git a/plugins/two-factor-auth/langs/fr_FR.ini b/plugins/two-factor-auth/langs/fr_FR.ini index 6fa94691b..4e816a027 100644 --- a/plugins/two-factor-auth/langs/fr_FR.ini +++ b/plugins/two-factor-auth/langs/fr_FR.ini @@ -10,7 +10,6 @@ BUTTON_ACTIVATE = "Activer" LINK_TEST = "test" BUTTON_SHOW_SECRET = "Montrer la clé secrète" BUTTON_HIDE_SECRET = "Masquer la clé secrète" -TWO_FACTOR_REQUIRE_DESC = "Votre compte requiert la configuration d'une vérification en deux étapes." TWO_FACTOR_SECRET_CONFIGURED_DESC = "Configuré" TWO_FACTOR_SECRET_NOT_CONFIGURED_DESC = "Non configuré" TWO_FACTOR_SECRET_DESC = "Importez ces informations dans votre client Google Authenticator (ou un autre client TOTP) en utilisant le code QR fourni ci-dessous ou en entrant les valeurs manuellement." diff --git a/plugins/two-factor-auth/langs/hu-HU.ini b/plugins/two-factor-auth/langs/hu-HU.ini index 655661a7c..62c83aa2c 100644 --- a/plugins/two-factor-auth/langs/hu-HU.ini +++ b/plugins/two-factor-auth/langs/hu-HU.ini @@ -10,7 +10,6 @@ BUTTON_ACTIVATE = "Aktivál" LINK_TEST = "teszt" BUTTON_SHOW_SECRET = "Titok megjelenítése" BUTTON_HIDE_SECRET = "Titok elrejtése" -TWO_FACTOR_REQUIRE_DESC = "A fiókhoz 2 lépcsős hitelesítés szükséges." TWO_FACTOR_SECRET_CONFIGURED_DESC = "Beállítva" TWO_FACTOR_SECRET_NOT_CONFIGURED_DESC = "Nincs beállítva" TWO_FACTOR_SECRET_DESC = "Importáld ezt az infót a Google Authenticator kliensedbe (vagy más TOTP kliensbe) az alábbi QR kód használatával vagy a kód manuális megadatásával.\n" diff --git a/plugins/two-factor-auth/langs/it_IT.ini b/plugins/two-factor-auth/langs/it_IT.ini index e44f42c70..a8252fedc 100644 --- a/plugins/two-factor-auth/langs/it_IT.ini +++ b/plugins/two-factor-auth/langs/it_IT.ini @@ -13,7 +13,6 @@ BUTTON_ACTIVATE = "Attiva" LINK_TEST = "test" BUTTON_SHOW_SECRET = "Mostra la chiave segreta" BUTTON_HIDE_SECRET = "Nascondi la chiave segreta" -TWO_FACTOR_REQUIRE_DESC = "Il tuo account richiede la configurazione della verifica a 2 fattori." TWO_FACTOR_SECRET_CONFIGURED_DESC = "Configurato" TWO_FACTOR_SECRET_NOT_CONFIGURED_DESC = "Non configurato" TWO_FACTOR_SECRET_DESC = "Importa queste informazioni nella tua app Google Authenticator (o un altro programma per l'autenticazione a due fattori) utilizzando il codice QR fornito qui sotto o inserendo il codice manualmente.\n" diff --git a/plugins/two-factor-auth/langs/nl_NL.ini b/plugins/two-factor-auth/langs/nl_NL.ini index 5cf4bada1..d48c636d7 100644 --- a/plugins/two-factor-auth/langs/nl_NL.ini +++ b/plugins/two-factor-auth/langs/nl_NL.ini @@ -10,7 +10,6 @@ BUTTON_ACTIVATE = "Activate" LINK_TEST = "test" BUTTON_SHOW_SECRET = "Bekijk geheime sleutel" BUTTON_HIDE_SECRET = "Verberg geheime sleutel" -TWO_FACTOR_REQUIRE_DESC = "Uw account vereist 2-Stap verificatie configuratie." TWO_FACTOR_SECRET_CONFIGURED_DESC = "Geconfigureerd" TWO_FACTOR_SECRET_NOT_CONFIGURED_DESC = "Niet geconfigureerd" TWO_FACTOR_SECRET_DESC = "Importeer deze informatie in uw Google Authenticator-client (of andere TOTP-client) door gebruik te maken van de QR code hier beneden of door de code handmatig in te voeren." diff --git a/plugins/two-factor-auth/langs/sv-SE.ini b/plugins/two-factor-auth/langs/sv-SE.ini index 387d9f625..479151159 100644 --- a/plugins/two-factor-auth/langs/sv-SE.ini +++ b/plugins/two-factor-auth/langs/sv-SE.ini @@ -10,7 +10,6 @@ BUTTON_ACTIVATE = "Aktivera" LINK_TEST = "test" BUTTON_SHOW_SECRET = "Visa hemlig kod" BUTTON_HIDE_SECRET = "Göm hemlig kod" -TWO_FACTOR_REQUIRE_DESC = "Ditt konto kräver tvåstegsverifiering." TWO_FACTOR_SECRET_CONFIGURED_DESC = "Konfigurerad" TWO_FACTOR_SECRET_NOT_CONFIGURED_DESC = "Inte konfigurarad" TWO_FACTOR_SECRET_DESC = "Importera denna information till din Google Authenticator klient (eller annan TOTP klient) med denna QR kod eller manuellt med koden här nedan." diff --git a/plugins/two-factor-auth/langs/zh_CN.ini b/plugins/two-factor-auth/langs/zh_CN.ini index c4f923852..948a6d886 100644 --- a/plugins/two-factor-auth/langs/zh_CN.ini +++ b/plugins/two-factor-auth/langs/zh_CN.ini @@ -10,7 +10,6 @@ BUTTON_ACTIVATE = "启用" LINK_TEST = "测试" BUTTON_SHOW_SECRET = "显示密钥" BUTTON_HIDE_SECRET = "隐藏密钥" -TWO_FACTOR_REQUIRE_DESC = "您的账户需要设置两步验证。" TWO_FACTOR_SECRET_CONFIGURED_DESC = "已设置" TWO_FACTOR_SECRET_NOT_CONFIGURED_DESC = "未设置" TWO_FACTOR_SECRET_DESC = "将下面的信息导入 Google Authenticator (或其他 TOTP 客户端)。 扫描下面的二维码或手动输入密钥。\n" diff --git a/plugins/two-factor-auth/templates/TwoFactorAuthSettings.html b/plugins/two-factor-auth/templates/TwoFactorAuthSettings.html index 077ced658..87a3875ce 100644 --- a/plugins/two-factor-auth/templates/TwoFactorAuthSettings.html +++ b/plugins/two-factor-auth/templates/TwoFactorAuthSettings.html @@ -24,12 +24,7 @@
- -
-
-

-
-
+
@@ -69,10 +64,6 @@
- - - - @@ -82,7 +73,7 @@