diff --git a/README.md b/README.md index 5f7cfc1305c8..d3750cd7da87 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,7 @@ Go through [DEVCONTAINER.md](docs/DEVCONTAINER.md) for more info. ## Dependencies -Desktop versions use Flutter or Sciter (deprecated) for GUI, this tutorial is for Sciter only, since it is easier and more friendly to starter. Check out our [CI](https://github.com/rustdesk/rustdesk/blob/master/.github/workflows/flutter-build.yml) for building Flutter version. +Desktop versions use Flutter or Sciter (deprecated) for GUI, this tutorial is for Sciter only, since it is easier and more friendly to start. Check out our [CI](https://github.com/rustdesk/rustdesk/blob/master/.github/workflows/flutter-build.yml) for building Flutter version. Please download Sciter dynamic library yourself. diff --git a/flutter/lib/common/hbbs/hbbs.dart b/flutter/lib/common/hbbs/hbbs.dart index 2bb5bc40bc49..b500afd5eb61 100644 --- a/flutter/lib/common/hbbs/hbbs.dart +++ b/flutter/lib/common/hbbs/hbbs.dart @@ -121,6 +121,7 @@ class LoginRequest { String? type; String? verificationCode; String? tfaCode; + String? secret; LoginRequest( {this.username, @@ -130,7 +131,8 @@ class LoginRequest { this.autoLogin, this.type, this.verificationCode, - this.tfaCode}); + this.tfaCode, + this.secret}); Map toJson() { final Map data = {}; @@ -144,6 +146,7 @@ class LoginRequest { data['verificationCode'] = verificationCode; } if (tfaCode != null) data['tfaCode'] = tfaCode; + if (secret != null) data['secret'] = secret; Map deviceInfo = {}; try { @@ -160,14 +163,17 @@ class LoginResponse { String? access_token; String? type; String? tfa_type; + String? secret; UserPayload? user; - LoginResponse({this.access_token, this.type, this.tfa_type, this.user}); + LoginResponse( + {this.access_token, this.type, this.tfa_type, this.secret, this.user}); LoginResponse.fromJson(Map json) { access_token = json['access_token']; type = json['type']; tfa_type = json['tfa_type']; + secret = json['secret']; user = json['user'] != null ? UserPayload.fromJson(json['user']) : null; } } diff --git a/flutter/lib/common/widgets/dialog.dart b/flutter/lib/common/widgets/dialog.dart index 21dcb933315f..78487eb86313 100644 --- a/flutter/lib/common/widgets/dialog.dart +++ b/flutter/lib/common/widgets/dialog.dart @@ -1,6 +1,5 @@ import 'dart:async'; import 'dart:io'; -import 'dart:ui'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; @@ -429,7 +428,6 @@ class Dialog2FaField extends ValidationField { this.autoFocus = true, this.reRequestFocus = false, this.title, - this.helperText, this.hintText, this.errorText, this.readyCallback, @@ -440,7 +438,6 @@ class Dialog2FaField extends ValidationField { final bool autoFocus; final bool reRequestFocus; final String? title; - final String? helperText; final String? hintText; final String? errorText; final VoidCallback? readyCallback; @@ -457,7 +454,6 @@ class Dialog2FaField extends ValidationField { reRequestFocus: reRequestFocus, hintText: hintText, readyCallback: readyCallback, - helperText: helperText ?? translate('2fa_tip'), onChanged: _onChanged, keyboardType: TextInputType.number, inputFormatters: [ @@ -1860,6 +1856,8 @@ void enter2FaDialog( 'OK', onPressed: submitReady.isTrue ? submit : null, )), - ]); + ], + onSubmit: submit, + onCancel: cancel); }); } diff --git a/flutter/lib/common/widgets/login.dart b/flutter/lib/common/widgets/login.dart index 64ea188a0987..a6b8048a8e93 100644 --- a/flutter/lib/common/widgets/login.dart +++ b/flutter/lib/common/widgets/login.dart @@ -390,8 +390,7 @@ class LoginWidgetUserPass extends StatelessWidget { const kAuthReqTypeOidc = 'oidc/'; -/// common login dialog for desktop -/// call this directly +// call this directly Future loginDialog() async { var username = TextEditingController(text: UserModel.getLocalUserInfo()?['name'] ?? ''); @@ -457,11 +456,12 @@ Future loginDialog() async { if (isEmailVerification != null) { if (isMobile) { if (close != null) close(false); - verificationCodeDialog(resp.user, isEmailVerification); + verificationCodeDialog( + resp.user, resp.secret, isEmailVerification); } else { setState(() => isInProgress = false); - final res = - await verificationCodeDialog(resp.user, isEmailVerification); + final res = await verificationCodeDialog( + resp.user, resp.secret, isEmailVerification); if (res == true) { if (close != null) close(false); return; @@ -611,7 +611,7 @@ Future loginDialog() async { } Future verificationCodeDialog( - UserPayload? user, bool isEmailVerification) async { + UserPayload? user, String? secret, bool isEmailVerification) async { var autoLogin = true; var isInProgress = false; String? errorText; @@ -626,6 +626,7 @@ Future verificationCodeDialog( final resp = await gFFI.userModel.login(LoginRequest( verificationCode: code.text, tfaCode: isEmailVerification ? null : code.text, + secret: secret, username: user?.name, id: await bind.mainGetMyId(), uuid: await bind.mainGetUuid(), diff --git a/src/hbbs_http/account.rs b/src/hbbs_http/account.rs index 7e35905b2476..3f1a7f1c12b3 100644 --- a/src/hbbs_http/account.rs +++ b/src/hbbs_http/account.rs @@ -97,6 +97,8 @@ pub struct AuthBody { pub r#type: String, #[serde(default)] pub tfa_type: String, + #[serde(default)] + pub secret: String, pub user: UserPayload, } diff --git a/src/lang/ar.rs b/src/lang/ar.rs index c32ab5648d3c..cd57ef865cf3 100644 --- a/src/lang/ar.rs +++ b/src/lang/ar.rs @@ -579,7 +579,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Swap control-command key", ""), ("swap-left-right-mouse", ""), ("2FA code", ""), - ("2fa_tip", ""), ("More", ""), ("enable-2fa-title", ""), ("enable-2fa-desc", ""), diff --git a/src/lang/ca.rs b/src/lang/ca.rs index 8cf0b3839911..246825d18328 100644 --- a/src/lang/ca.rs +++ b/src/lang/ca.rs @@ -579,7 +579,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Swap control-command key", ""), ("swap-left-right-mouse", ""), ("2FA code", ""), - ("2fa_tip", ""), ("More", ""), ("enable-2fa-title", ""), ("enable-2fa-desc", ""), diff --git a/src/lang/cn.rs b/src/lang/cn.rs index e7a8e2b0f50e..7103de5bdcd6 100644 --- a/src/lang/cn.rs +++ b/src/lang/cn.rs @@ -579,7 +579,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Swap control-command key", "交换Control键和Command键"), ("swap-left-right-mouse", "交换鼠标左右键"), ("2FA code", "双重认证代码"), - ("2fa_tip", "请输入授权 app 中的双重认证代码"), ("More", "更多"), ("enable-2fa-title", "启用双重认证"), ("enable-2fa-desc", "现在请设置身份验证器。您可以在手机或台式电脑上使用 Authy、Microsoft 或 Google Authenticator 等验证器。用验证器扫描二维码,然后输入显示的验证码以启用双重认证。"), diff --git a/src/lang/cs.rs b/src/lang/cs.rs index 447284bec3b1..ba504800cac4 100644 --- a/src/lang/cs.rs +++ b/src/lang/cs.rs @@ -579,7 +579,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Swap control-command key", "Prohození klávesy control-command"), ("swap-left-right-mouse", "Prohodit levé a pravé tlačítko myši"), ("2FA code", "2FA kód"), - ("2fa_tip", "Zadejte svůj kód 2FA do ověřovací aplikace."), ("More", "Více"), ("enable-2fa-title", ""), ("enable-2fa-desc", ""), diff --git a/src/lang/da.rs b/src/lang/da.rs index a925bcc391bd..52f423b2449a 100644 --- a/src/lang/da.rs +++ b/src/lang/da.rs @@ -579,7 +579,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Swap control-command key", ""), ("swap-left-right-mouse", ""), ("2FA code", ""), - ("2fa_tip", ""), ("More", ""), ("enable-2fa-title", ""), ("enable-2fa-desc", ""), diff --git a/src/lang/de.rs b/src/lang/de.rs index e6a70b75e68f..580b1f01cc94 100644 --- a/src/lang/de.rs +++ b/src/lang/de.rs @@ -579,7 +579,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Swap control-command key", "Steuerungs- und Befehlstasten tauschen"), ("swap-left-right-mouse", "Linke und rechte Maustaste tauschen"), ("2FA code", "2FA-Code"), - ("2fa_tip", "Bitte geben Sie Ihren 2FA-Code in der Authentifizierungs-App ein."), ("More", "Mehr"), ("enable-2fa-title", "Zwei-Faktor-Authentifizierung aktivieren"), ("enable-2fa-desc", "Bitte richten Sie jetzt Ihren Authentifikator ein. Sie können eine Authentifizierungs-App wie Authy, Microsoft oder Google Authenticator auf Ihrem Telefon oder Desktop verwenden.\n\nScannen Sie den QR-Code mit Ihrer App und geben Sie den Code ein, den Ihre App anzeigt, um die Zwei-Faktor-Authentifizierung zu aktivieren."), diff --git a/src/lang/el.rs b/src/lang/el.rs index 093e3ac2591a..7070eb2aa1f5 100644 --- a/src/lang/el.rs +++ b/src/lang/el.rs @@ -579,7 +579,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Swap control-command key", "Εναλλαγή κουμπιών control-command"), ("swap-left-right-mouse", "Εναλλαγή αριστερό-δεξί κουμπί του ποντικιού"), ("2FA code", "κωδικός 2FA"), - ("2fa_tip", "Παρακαλώ εισάγεται τον κωδικό 2FA στην εφαρμογή πιστοποίησης"), ("More", "Περισσότερα"), ("enable-2fa-title", ""), ("enable-2fa-desc", ""), diff --git a/src/lang/en.rs b/src/lang/en.rs index cc382e7f773a..5e091d137979 100644 --- a/src/lang/en.rs +++ b/src/lang/en.rs @@ -211,7 +211,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("capture_display_elevated_connections_tip", "Capturing multiple displays is not supported in the elevated user mode. Please try again after installation if you want to control multiple displays."), ("swap-left-right-mouse", "Swap left-right mouse button"), ("2FA code", "2FA code"), - ("2fa_tip", "Please enter your 2FA code in the authentication app."), ("enable-2fa-title", "Enable two-factor authentication"), ("enable-2fa-desc", "Please set up your authenticator now. You can use an authenticator app such as Authy, Microsoft or Google Authenticator on your phone or desktop.\n\nScan the QR code with your app and enter the code that your app shows to enable two-factor authentication."), ("wrong-2fa-code", "Can't verify the code. Check that code and local time settings are correct"), diff --git a/src/lang/eo.rs b/src/lang/eo.rs index 2d1980ffd433..ba73d48bd39a 100644 --- a/src/lang/eo.rs +++ b/src/lang/eo.rs @@ -579,7 +579,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Swap control-command key", ""), ("swap-left-right-mouse", ""), ("2FA code", ""), - ("2fa_tip", ""), ("More", ""), ("enable-2fa-title", ""), ("enable-2fa-desc", ""), diff --git a/src/lang/es.rs b/src/lang/es.rs index fad51450665e..61777b64f3d0 100644 --- a/src/lang/es.rs +++ b/src/lang/es.rs @@ -579,7 +579,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Swap control-command key", "Intercambiar teclas control-comando"), ("swap-left-right-mouse", "Intercambiar botones derecho-izquierdo del ratón"), ("2FA code", ""), - ("2fa_tip", ""), ("More", ""), ("enable-2fa-title", ""), ("enable-2fa-desc", ""), diff --git a/src/lang/et.rs b/src/lang/et.rs index 5614da9756e5..651189aa66c1 100644 --- a/src/lang/et.rs +++ b/src/lang/et.rs @@ -579,7 +579,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Swap control-command key", ""), ("swap-left-right-mouse", "Vaheta vasak ja parem hiirenupp"), ("2FA code", ""), - ("2fa_tip", ""), ("More", ""), ("enable-2fa-title", ""), ("enable-2fa-desc", ""), diff --git a/src/lang/fa.rs b/src/lang/fa.rs index df8d1a222698..df2c6e114643 100644 --- a/src/lang/fa.rs +++ b/src/lang/fa.rs @@ -579,7 +579,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Swap control-command key", "گرفتن چندین نمایشگر در حالت کاربر زیاد پشتیبانی نمی شود. اگر می‌خواهید چند نمایشگر را کنترل کنید، لطفاً پس از نصب دوباره امتحان کنید."), ("swap-left-right-mouse", "دکمه چپ و راست ماوس را عوض کنید"), ("2FA code", "کد ورود 2 مرحله ای"), - ("2fa_tip", "لطفا کد ورود 2 مرحله ای خود را در برنامه احراز هویت وارد کنید"), ("More", ""), ("enable-2fa-title", ""), ("enable-2fa-desc", ""), diff --git a/src/lang/fr.rs b/src/lang/fr.rs index 60f9eb989aff..3dcc4d411f16 100644 --- a/src/lang/fr.rs +++ b/src/lang/fr.rs @@ -579,7 +579,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Swap control-command key", "Échanger la touche de controle-commande"), ("swap-left-right-mouse", "Intervertir le bouton gauche et droit de la souris"), ("2FA code", ""), - ("2fa_tip", ""), ("More", ""), ("enable-2fa-title", ""), ("enable-2fa-desc", ""), diff --git a/src/lang/hu.rs b/src/lang/hu.rs index c3b1ebd04c8e..623ab273f01b 100644 --- a/src/lang/hu.rs +++ b/src/lang/hu.rs @@ -579,7 +579,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Swap control-command key", ""), ("swap-left-right-mouse", ""), ("2FA code", ""), - ("2fa_tip", ""), ("More", ""), ("enable-2fa-title", ""), ("enable-2fa-desc", ""), diff --git a/src/lang/id.rs b/src/lang/id.rs index bb2ccecc2bd7..31e1018e2ec3 100644 --- a/src/lang/id.rs +++ b/src/lang/id.rs @@ -579,7 +579,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Swap control-command key", ""), ("swap-left-right-mouse", ""), ("2FA code", ""), - ("2fa_tip", ""), ("More", ""), ("enable-2fa-title", ""), ("enable-2fa-desc", ""), diff --git a/src/lang/it.rs b/src/lang/it.rs index c3a272bd0294..5fe9808c2ecc 100644 --- a/src/lang/it.rs +++ b/src/lang/it.rs @@ -579,7 +579,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Swap control-command key", "Scambia tasto controllo-comando"), ("swap-left-right-mouse", "Scambia pulsante sinistro-destro mouse"), ("2FA code", "Codice 2FA"), - ("2fa_tip", "Inserisci il codice 2FA nell'app di autenticazione."), ("More", "Altro"), ("enable-2fa-title", ""), ("enable-2fa-desc", ""), diff --git a/src/lang/ja.rs b/src/lang/ja.rs index 96ac8c417be2..f2328a8b20f1 100644 --- a/src/lang/ja.rs +++ b/src/lang/ja.rs @@ -579,7 +579,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Swap control-command key", ""), ("swap-left-right-mouse", ""), ("2FA code", ""), - ("2fa_tip", ""), ("More", ""), ("enable-2fa-title", ""), ("enable-2fa-desc", ""), diff --git a/src/lang/ko.rs b/src/lang/ko.rs index e5aefadef9ce..b8174a44c4d1 100644 --- a/src/lang/ko.rs +++ b/src/lang/ko.rs @@ -579,7 +579,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Swap control-command key", ""), ("swap-left-right-mouse", ""), ("2FA code", ""), - ("2fa_tip", ""), ("More", ""), ("enable-2fa-title", ""), ("enable-2fa-desc", ""), diff --git a/src/lang/kz.rs b/src/lang/kz.rs index 96205d401898..61f3ba5eed44 100644 --- a/src/lang/kz.rs +++ b/src/lang/kz.rs @@ -579,7 +579,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Swap control-command key", ""), ("swap-left-right-mouse", ""), ("2FA code", ""), - ("2fa_tip", ""), ("More", ""), ("enable-2fa-title", ""), ("enable-2fa-desc", ""), diff --git a/src/lang/lt.rs b/src/lang/lt.rs index 1bec420e3b01..7588830f8650 100644 --- a/src/lang/lt.rs +++ b/src/lang/lt.rs @@ -579,7 +579,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Swap control-command key", ""), ("swap-left-right-mouse", ""), ("2FA code", ""), - ("2fa_tip", ""), ("More", ""), ("enable-2fa-title", ""), ("enable-2fa-desc", ""), diff --git a/src/lang/lv.rs b/src/lang/lv.rs index 81aea41b84ce..e2177b96410d 100644 --- a/src/lang/lv.rs +++ b/src/lang/lv.rs @@ -579,7 +579,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Swap control-command key", "Apmainīt vadības un komandas taustiņu"), ("swap-left-right-mouse", "Apmainīt kreiso un labo peles pogu"), ("2FA code", "2FA kods"), - ("2fa_tip", "Lūdzu, ievadiet savu 2FA kodu autentifikācijas lietotnē."), ("More", "Vairāk"), ("enable-2fa-title", "Iespējot divu faktoru autentifikāciju"), ("enable-2fa-desc", "Lūdzu, iestatiet savu autentifikatoru tūlīt. Tālrunī vai darbvirsmā varat izmantot autentifikācijas lietotni, piemēram, Authy, Microsoft vai Google Authenticator.\n\nIzmantojot lietotni, skenējiet QR kodu un ievadiet lietotnē parādīto kodu, lai iespējotu divu faktoru autentifikāciju."), diff --git a/src/lang/nb.rs b/src/lang/nb.rs index 7be99f637318..6c091665b46f 100644 --- a/src/lang/nb.rs +++ b/src/lang/nb.rs @@ -579,7 +579,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Swap control-command key", ""), ("swap-left-right-mouse", ""), ("2FA code", ""), - ("2fa_tip", ""), ("More", ""), ("enable-2fa-title", ""), ("enable-2fa-desc", ""), diff --git a/src/lang/nl.rs b/src/lang/nl.rs index 4f7495a5a9dd..10b57c38decc 100644 --- a/src/lang/nl.rs +++ b/src/lang/nl.rs @@ -579,7 +579,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Swap control-command key", "Wissel controle-commando toets"), ("swap-left-right-mouse", "wissel-links-rechts-muis"), ("2FA code", "2FA-code"), - ("2fa_tip", "Geef je 2FA-code op in de verificatie-app."), ("More", "Meer"), ("enable-2fa-title", "activeer-2fa-titel"), ("enable-2fa-desc", "activeer-2fa-desc"), diff --git a/src/lang/pl.rs b/src/lang/pl.rs index 8f77d10393b9..a9c2eafdc9dd 100644 --- a/src/lang/pl.rs +++ b/src/lang/pl.rs @@ -579,7 +579,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Swap control-command key", "Zamiana przycisków sterujących myszki"), ("swap-left-right-mouse", "Zamień przyciski myszki (lewy - prawy)"), ("2FA code", "Kod 2FA"), - ("2fa_tip", "Proszę wprowadzić swój kod 2FA w aplikacji do autoryzacji."), ("More", "Więcej"), ("enable-2fa-title", ""), ("enable-2fa-desc", ""), diff --git a/src/lang/pt_PT.rs b/src/lang/pt_PT.rs index 6d753ffd1470..d3775aef7aa6 100644 --- a/src/lang/pt_PT.rs +++ b/src/lang/pt_PT.rs @@ -579,7 +579,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Swap control-command key", ""), ("swap-left-right-mouse", ""), ("2FA code", ""), - ("2fa_tip", ""), ("More", ""), ("enable-2fa-title", ""), ("enable-2fa-desc", ""), diff --git a/src/lang/ptbr.rs b/src/lang/ptbr.rs index caead766cdaf..e52612bc1592 100644 --- a/src/lang/ptbr.rs +++ b/src/lang/ptbr.rs @@ -579,7 +579,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Swap control-command key", ""), ("swap-left-right-mouse", ""), ("2FA code", ""), - ("2fa_tip", ""), ("More", ""), ("enable-2fa-title", ""), ("enable-2fa-desc", ""), diff --git a/src/lang/ro.rs b/src/lang/ro.rs index 52b7e45f6375..a7cf40490e29 100644 --- a/src/lang/ro.rs +++ b/src/lang/ro.rs @@ -579,7 +579,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Swap control-command key", ""), ("swap-left-right-mouse", ""), ("2FA code", ""), - ("2fa_tip", ""), ("More", ""), ("enable-2fa-title", ""), ("enable-2fa-desc", ""), diff --git a/src/lang/ru.rs b/src/lang/ru.rs index eb349a8182ac..3048e0304103 100644 --- a/src/lang/ru.rs +++ b/src/lang/ru.rs @@ -579,7 +579,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Swap control-command key", "Поменять кнопки управления и команд"), ("swap-left-right-mouse", "Поменять левую и правую кнопки мыши"), ("2FA code", "Код 2FA"), - ("2fa_tip", "Введите код двухфакторной аутентификации из приложения для аутентификации."), ("More", "Ещё"), ("enable-2fa-title", "Использовать двухфакторную аутентификацию"), ("enable-2fa-desc", "Настройте приложение аутентификации. Используйте, например, Authy, Microsoft или Google Authenticator, на телефоне или компьютере.\n\nОтсканируйте QR-код с помощью приложения аутентификации и введите код, который отобразит это приложение, чтобы включить двухфакторную аутентификацию."), diff --git a/src/lang/sk.rs b/src/lang/sk.rs index 6cf4cda6ee57..d1cca6772e06 100644 --- a/src/lang/sk.rs +++ b/src/lang/sk.rs @@ -579,7 +579,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Swap control-command key", "Vymeniť kláves ovládania a príkazu"), ("swap-left-right-mouse", "Prehodiť ľavé a pravé tlačidlo myši"), ("2FA code", "2FA kód"), - ("2fa_tip", "Zadajte svoj kód 2FA do aplikácie na overovanie."), ("More", "Viac"), ("enable-2fa-title", ""), ("enable-2fa-desc", ""), diff --git a/src/lang/sl.rs b/src/lang/sl.rs index c5295637e9de..c29a8884e4b9 100755 --- a/src/lang/sl.rs +++ b/src/lang/sl.rs @@ -579,7 +579,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Swap control-command key", ""), ("swap-left-right-mouse", ""), ("2FA code", ""), - ("2fa_tip", ""), ("More", ""), ("enable-2fa-title", ""), ("enable-2fa-desc", ""), diff --git a/src/lang/sq.rs b/src/lang/sq.rs index 480bf55103d6..34d45fe26c75 100644 --- a/src/lang/sq.rs +++ b/src/lang/sq.rs @@ -579,7 +579,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Swap control-command key", ""), ("swap-left-right-mouse", ""), ("2FA code", ""), - ("2fa_tip", ""), ("More", ""), ("enable-2fa-title", ""), ("enable-2fa-desc", ""), diff --git a/src/lang/sr.rs b/src/lang/sr.rs index f50ddd0a6cfe..80712b544b07 100644 --- a/src/lang/sr.rs +++ b/src/lang/sr.rs @@ -579,7 +579,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Swap control-command key", ""), ("swap-left-right-mouse", ""), ("2FA code", ""), - ("2fa_tip", ""), ("More", ""), ("enable-2fa-title", ""), ("enable-2fa-desc", ""), diff --git a/src/lang/sv.rs b/src/lang/sv.rs index e30d2ed3b221..33340d42326e 100644 --- a/src/lang/sv.rs +++ b/src/lang/sv.rs @@ -579,7 +579,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Swap control-command key", ""), ("swap-left-right-mouse", ""), ("2FA code", ""), - ("2fa_tip", ""), ("More", ""), ("enable-2fa-title", ""), ("enable-2fa-desc", ""), diff --git a/src/lang/template.rs b/src/lang/template.rs index eb5855e82446..762f98ec735a 100644 --- a/src/lang/template.rs +++ b/src/lang/template.rs @@ -579,7 +579,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Swap control-command key", ""), ("swap-left-right-mouse", ""), ("2FA code", ""), - ("2fa_tip", ""), ("More", ""), ("enable-2fa-title", ""), ("enable-2fa-desc", ""), diff --git a/src/lang/th.rs b/src/lang/th.rs index 59723a266720..547fb096a3b1 100644 --- a/src/lang/th.rs +++ b/src/lang/th.rs @@ -579,7 +579,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Swap control-command key", ""), ("swap-left-right-mouse", ""), ("2FA code", ""), - ("2fa_tip", ""), ("More", ""), ("enable-2fa-title", ""), ("enable-2fa-desc", ""), diff --git a/src/lang/tr.rs b/src/lang/tr.rs index 0a57843f4826..a6fd869d804c 100644 --- a/src/lang/tr.rs +++ b/src/lang/tr.rs @@ -579,7 +579,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Swap control-command key", ""), ("swap-left-right-mouse", ""), ("2FA code", ""), - ("2fa_tip", ""), ("More", ""), ("enable-2fa-title", ""), ("enable-2fa-desc", ""), diff --git a/src/lang/tw.rs b/src/lang/tw.rs index 5a84be5517dc..aa34a1c7f3ae 100644 --- a/src/lang/tw.rs +++ b/src/lang/tw.rs @@ -579,7 +579,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Swap control-command key", ""), ("swap-left-right-mouse", ""), ("2FA code", ""), - ("2fa_tip", ""), ("More", ""), ("enable-2fa-title", ""), ("enable-2fa-desc", ""), diff --git a/src/lang/ua.rs b/src/lang/ua.rs index 7f46929dd377..3755207cbe82 100644 --- a/src/lang/ua.rs +++ b/src/lang/ua.rs @@ -579,7 +579,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Swap control-command key", "Поміняти місцями клавіші Control та Command"), ("swap-left-right-mouse", "Поміняти місцями ліву та праву кнопки миші"), ("2FA code", "Код двофакторної автентифікації"), - ("2fa_tip", "Будь ласка, введіть код двофакторної автентифікації в застосунку для автентифікації."), ("More", "Більше"), ("enable-2fa-title", ""), ("enable-2fa-desc", ""), diff --git a/src/lang/vn.rs b/src/lang/vn.rs index d2eb11a3dd0b..c6e71d2e76c1 100644 --- a/src/lang/vn.rs +++ b/src/lang/vn.rs @@ -579,7 +579,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> = ("Swap control-command key", ""), ("swap-left-right-mouse", ""), ("2FA code", ""), - ("2fa_tip", ""), ("More", ""), ("enable-2fa-title", ""), ("enable-2fa-desc", ""), diff --git a/src/ui/index.tis b/src/ui/index.tis index 13c8141c3cc2..e1f487a15813 100644 --- a/src/ui/index.tis +++ b/src/ui/index.tis @@ -1242,13 +1242,14 @@ function login() { } function on_2fa_check(last_msg) { - var isEmailCheck = !last_msg.tfa_type || last_msg.tfa_type == 'email_check'; + const isEmailCheck = !last_msg.tfa_type || last_msg.tfa_type == 'email_check'; + const secret = last_msg.secret; + const emailHint = last_msg.user.email; - var emailHint = last_msg.user.email; msgbox("custom-2fa-verification-code", translate('Verification code'),
{ isEmailCheck &&
{translate('Email')}:{emailHint}
}
{translate(isEmailCheck ? 'Verification code' : '2FA code')}:
-
{translate(isEmailCheck ? 'verification_tip' : '2fa_tip')}
+ { isEmailCheck &&
{translate('verification_tip')}
}
, "", function(res=null, show_progress) { if (!res) return; @@ -1260,7 +1261,16 @@ function on_2fa_check(last_msg) { } abLoading = true; var url = handler.get_api_server(); - const loginData = {username: last_msg.user.name, id: my_id, uuid: handler.get_uuid(), type: 'email_code', verificationCode: code, tfaCode: isEmailCheck ? '' : code, deviceInfo: getDeviceInfo()}; + const loginData = { + username: last_msg.user.name, + id: my_id, + uuid: handler.get_uuid(), + type: 'email_code', + verificationCode: code, + tfaCode: isEmailCheck ? '' : code, + secret: secret, + deviceInfo: getDeviceInfo() + }; httpRequest(url + "/api/login", #post, loginData, function(data) { if (data.error) {