Merge pull request #2251 from 21pages/password

rename temporary password to one-time password
This commit is contained in:
RustDesk 2022-11-21 15:58:44 +08:00 committed by GitHub
commit 596ee50805
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
31 changed files with 116 additions and 90 deletions

View File

@ -2,6 +2,7 @@ import 'dart:async';
import 'dart:io';
import 'dart:convert';
import 'package:auto_size_text/auto_size_text.dart';
import 'package:flutter/material.dart' hide MenuItem;
import 'package:flutter/services.dart';
import 'package:flutter_hbb/common.dart';
@ -202,10 +203,11 @@ class _DesktopHomePageState extends State<DesktopHomePage>
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
translate("Password"),
AutoSizeText(
translate("One-time Password"),
style: TextStyle(
fontSize: 14, color: textColor?.withOpacity(0.5)),
maxLines: 1,
),
Row(
children: [

View File

@ -586,7 +586,7 @@ class _SafetyState extends State<_Safety> with AutomaticKeepAliveClientMixin {
kUseBothPasswords,
];
List<String> passwordValues = [
translate('Use temporary password'),
translate('Use one-time password'),
translate('Use permanent password'),
translate('Use both passwords'),
];
@ -665,7 +665,7 @@ class _SafetyState extends State<_Safety> with AutomaticKeepAliveClientMixin {
Offstage(
offstage: !usePassword,
child: _SubLabeledWidget(
'Temporary Password Length',
'One-time password length',
Row(
children: [
...lengthRadios,

View File

@ -35,7 +35,8 @@ class ServerModel with ChangeNotifier {
late String _emptyIdShow;
late final IDTextEditingController _serverId;
final _serverPasswd = TextEditingController(text: "");
final _serverPasswd =
TextEditingController(text: translate("Generating ..."));
final tabController = DesktopTabController(tabType: DesktopTabType.cm);
@ -170,7 +171,8 @@ class ServerModel with ChangeNotifier {
update = true;
}
final oldPwdText = _serverPasswd.text;
if (_serverPasswd.text != temporaryPassword) {
if (_serverPasswd.text != temporaryPassword &&
temporaryPassword.isNotEmpty) {
_serverPasswd.text = temporaryPassword;
}
if (verificationMethod == kUsePermanentPassword ||

View File

@ -13,6 +13,13 @@ enum VerificationMethod {
UseBothPasswords,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum ApproveMode {
Both,
Password,
Click,
}
// Should only be called in server
pub fn update_temporary_password() {
*TEMPORARY_PASSWORD.write().unwrap() = Config::get_auto_password(temporary_password_length());
@ -58,6 +65,17 @@ pub fn has_valid_password() -> bool {
|| permanent_enabled() && !Config::get_permanent_password().is_empty()
}
pub fn approve_mode() -> ApproveMode {
let mode = Config::get_option("approve-mode");
if mode == "password" {
ApproveMode::Password
} else if mode == "click" {
ApproveMode::Click
} else {
ApproveMode::Both
}
}
const VERSION_LEN: usize = 2;
pub fn encrypt_str_or_original(s: &str, version: &str) -> String {

View File

@ -303,11 +303,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Legacy mode", "Mode heretat"),
("Map mode", "Mode mapa"),
("Translate mode", "Mode traduit"),
("Use temporary password", "Utilitzar contrasenya temporal"),
("Use permanent password", "Utilitzar contrasenya permament"),
("Use both passwords", "Utilitzar ambdues contrasenyas"),
("Set permanent password", "Establir contrasenya permament"),
("Set temporary password length", "Establir llargada de la contrasenya temporal"),
("Enable Remote Restart", "Activar reinici remot"),
("Allow remote restart", "Permetre reinici remot"),
("Restart Remote Device", "Reiniciar dispositiu"),
@ -343,7 +341,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Enable hardware codec", "Habilitar còdec per hardware"),
("Unlock Security Settings", "Desbloquejar ajustaments de seguritat"),
("Enable Audio", "Habilitar àudio"),
("Temporary Password Length", "Longitut de Contrasenya Temporal"),
("Unlock Network Settings", "Desbloquejar Ajustaments de Xarxa"),
("Server", "Servidor"),
("Direct IP Access", "Accés IP Directe"),
@ -393,5 +390,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Accept sessions via click", ""),
("Accept sessions via both", ""),
("Please wait for the remote side to accept your session request...", ""),
("One-time Password", ""),
("Use one-time password", ""),
("One-time password length", ""),
].iter().cloned().collect();
}

View File

@ -303,11 +303,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Legacy mode", "传统模式"),
("Map mode", "11传输"),
("Translate mode", "翻译模式"),
("Use temporary password", "使用临时密码"),
("Use permanent password", "使用固定密码"),
("Use both passwords", "同时使用两种密码"),
("Set permanent password", "设置固定密码"),
("Set temporary password length", "设置临时密码长度"),
("Enable Remote Restart", "允许远程重启"),
("Allow remote restart", "允许远程重启"),
("Restart Remote Device", "重启远程电脑"),
@ -343,7 +341,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Enable hardware codec", "使用硬件编解码"),
("Unlock Security Settings", "解锁安全设置"),
("Enable Audio", "允许传输音频"),
("Temporary Password Length", "临时密码长度"),
("Unlock Network Settings", "解锁网络设置"),
("Server", "服务器"),
("Direct IP Access", "IP直接访问"),
@ -394,5 +391,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Accept sessions via click", "只允许点击访问"),
("Accept sessions via both", "允许密码或点击访问"),
("Please wait for the remote side to accept your session request...", "请等待对方接受你的连接..."),
("One-time Password", "一次性密码"),
("Use one-time password", "使用一次性密码"),
("One-time password length", "一次性密码长度"),
].iter().cloned().collect();
}

View File

@ -303,11 +303,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Legacy mode", ""),
("Map mode", ""),
("Translate mode", ""),
("Use temporary password", ""),
("Use permanent password", ""),
("Use both passwords", ""),
("Set permanent password", ""),
("Set temporary password length", ""),
("Enable Remote Restart", ""),
("Allow remote restart", ""),
("Restart Remote Device", ""),
@ -343,7 +341,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Enable hardware codec", ""),
("Unlock Security Settings", ""),
("Enable Audio", ""),
("Temporary Password Length", ""),
("Unlock Network Settings", ""),
("Server", ""),
("Direct IP Access", ""),
@ -394,5 +391,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Accept sessions via click", ""),
("Accept sessions via both", ""),
("Please wait for the remote side to accept your session request...", ""),
("One-time Password", ""),
("Use one-time password", ""),
("One-time password length", ""),
].iter().cloned().collect();
}

View File

@ -303,11 +303,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Legacy mode", "Bagudkompatibilitetstilstand"),
("Map mode", ""),
("Translate mode", ""),
("Use temporary password", "Brug midlertidig adgangskode"),
("Use permanent password", "Brug permanent adgangskode"),
("Use both passwords", "Bug begge adgangskoder"),
("Set permanent password", "Sæt permanent adgangskode"),
("Set temporary password length", "Sæt midlertidig adgangskode"),
("Enable Remote Restart", "Aktiver fjerngenstart"),
("Allow remote restart", "Tillad fjerngenstart"),
("Restart Remote Device", "Genstart fjernenhed"),
@ -343,7 +341,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Enable hardware codec", "Aktiver hardware-codec"),
("Unlock Security Settings", "Lås op for sikkerhedsinstillinger"),
("Enable Audio", "Aktiver Lyd"),
("Temporary Password Length", "Midlertidig Adgangskode Længde"),
("Unlock Network Settings", "Lås op for Netværksinstillinger"),
("Server", "Server"),
("Direct IP Access", "Direkte IP Adgang"),
@ -394,5 +391,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Accept sessions via click", ""),
("Accept sessions via both", ""),
("Please wait for the remote side to accept your session request...", ""),
("One-time Password", ""),
("Use one-time password", ""),
("One-time password length", ""),
].iter().cloned().collect();
}

View File

@ -303,11 +303,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Legacy mode", "Kompatibilitätsmodus"),
("Map mode", ""),
("Translate mode", "Übersetzungsmodus"),
("Use temporary password", "Temporäres Passwort verwenden"),
("Use permanent password", "Dauerhaftes Passwort verwenden"),
("Use both passwords", "Beide Passwörter verwenden"),
("Set permanent password", "Dauerhaftes Passwort setzen"),
("Set temporary password length", "Länge des temporären Passworts setzen"),
("Enable Remote Restart", "Entfernten Neustart aktivieren"),
("Allow remote restart", "Entfernten Neustart erlauben"),
("Restart Remote Device", "Entferntes Gerät neu starten"),
@ -343,7 +341,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Enable hardware codec", "Hardware-Codec aktivieren"),
("Unlock Security Settings", "Sicherheitseinstellungen entsperren"),
("Enable Audio", "Audio aktivieren"),
("Temporary Password Length", "Länge des temporären Passworts"),
("Unlock Network Settings", "Netzwerkeinstellungen entsperren"),
("Server", "Server"),
("Direct IP Access", "Direkter IP-Zugriff"),
@ -394,5 +391,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Accept sessions via click", ""),
("Accept sessions via both", ""),
("Please wait for the remote side to accept your session request...", ""),
("One-time Password", ""),
("Use one-time password", ""),
("One-time password length", ""),
].iter().cloned().collect();
}

View File

@ -303,11 +303,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Legacy mode", ""),
("Map mode", ""),
("Translate mode", ""),
("Use temporary password", ""),
("Use permanent password", ""),
("Use both passwords", ""),
("Set permanent password", ""),
("Set temporary password length", ""),
("Enable Remote Restart", ""),
("Allow remote restart", ""),
("Restart Remote Device", ""),
@ -343,7 +341,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Enable hardware codec", ""),
("Unlock Security Settings", ""),
("Enable Audio", ""),
("Temporary Password Length", ""),
("Unlock Network Settings", ""),
("Server", ""),
("Direct IP Access", ""),
@ -394,5 +391,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Accept sessions via click", ""),
("Accept sessions via both", ""),
("Please wait for the remote side to accept your session request...", ""),
("One-time Password", ""),
("Use one-time password", ""),
("One-time password length", ""),
].iter().cloned().collect();
}

View File

@ -303,11 +303,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Legacy mode", "Modo heredado"),
("Map mode", "Modo mapa"),
("Translate mode", "Modo traducido"),
("Use temporary password", "Usar contraseña temporal"),
("Use permanent password", "Usar contraseña permamente"),
("Use both passwords", "Usar ambas contraseñas"),
("Set permanent password", "Establecer contraseña permamente"),
("Set temporary password length", "Establecer largo de contraseña temporal"),
("Enable Remote Restart", "Activar reinicio remoto"),
("Allow remote restart", "Permitir reinicio remoto"),
("Restart Remote Device", "Reiniciar dispositivo"),
@ -343,7 +341,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Enable hardware codec", "Habilitar códec por hardware"),
("Unlock Security Settings", "Desbloquear ajustes de seguridad"),
("Enable Audio", "Habilitar Audio"),
("Temporary Password Length", "Longitud de Contraseña Temporal"),
("Unlock Network Settings", "Desbloquear Ajustes de Red"),
("Server", "Servidor"),
("Direct IP Access", "Acceso IP Directo"),
@ -394,5 +391,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Accept sessions via click", ""),
("Accept sessions via both", ""),
("Please wait for the remote side to accept your session request...", ""),
("One-time Password", ""),
("Use one-time password", ""),
("One-time password length", ""),
].iter().cloned().collect();
}

View File

@ -303,11 +303,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Legacy mode", "پشتیبانی موارد قدیمی"),
("Map mode", "حالت نقشه"),
("Translate mode", "حالت ترجمه"),
("Use temporary password", "از رمز عبور موقت استفاده کنید"),
("Use permanent password", "از رمز عبور دائمی استفاده کنید"),
("Use both passwords", "از هر دو رمز عبور استفاده کنید"),
("Set permanent password", "یک رمز عبور دائمی تنظیم کنید"),
("Set temporary password length", "تنظیم طول رمز عبور موقت"),
("Enable Remote Restart", "فعال کردن راه‌اندازی مجدد از راه دور"),
("Allow remote restart", "اجازه راه اندازی مجدد از راه دور"),
("Restart Remote Device", "راه‌اندازی مجدد دستگاه از راه دور"),
@ -343,7 +341,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Enable hardware codec", "از کدک سخت افزاری استفاده کنید"),
("Unlock Security Settings", "تنظیمات امنیتی را باز کنید"),
("Enable Audio", "صدا را روشن کنید"),
("Temporary Password Length", "طول رمز عبور موقت"),
("Unlock Network Settings", "باز کردن قفل تنظیمات شبکه"),
("Server", "سرور"),
("Direct IP Access", "دسترسی مستقیم به IP"),
@ -393,5 +390,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Accept sessions via click", ""),
("Accept sessions via both", ""),
("Please wait for the remote side to accept your session request...", ""),
("One-time Password", ""),
("Use one-time password", ""),
("One-time password length", ""),
].iter().cloned().collect();
}

View File

@ -303,11 +303,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Legacy mode", "Mode hérité"),
("Map mode", ""),
("Translate mode", ""),
("Use temporary password", "Utiliser un mot de passe temporaire"),
("Use permanent password", "Utiliser un mot de passe permanent"),
("Use both passwords", "Utiliser les mots de passe temporaire et permanent"),
("Set permanent password", "Définir le mot de passe permanent"),
("Set temporary password length", "Définir la longueur du mot de passe temporaire"),
("Enable Remote Restart", "Activer le redémarrage à distance"),
("Allow remote restart", "Autoriser le redémarrage à distance"),
("Restart Remote Device", "Redémarrer l'appareil à distance"),
@ -343,7 +341,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Enable hardware codec", "Activer le transcodage matériel"),
("Unlock Security Settings", "Déverrouiller les configurations de sécurité"),
("Enable Audio", "Activer l'audio"),
("Temporary Password Length", "Longueur mot de passe temporaire"),
("Unlock Network Settings", "Déverrouiller les configurations réseau"),
("Server", "Serveur"),
("Direct IP Access", "Accès IP direct"),
@ -394,5 +391,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Accept sessions via click", ""),
("Accept sessions via both", ""),
("Please wait for the remote side to accept your session request...", ""),
("One-time Password", ""),
("Use one-time password", ""),
("One-time password length", ""),
].iter().cloned().collect();
}

View File

@ -303,11 +303,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Legacy mode", ""),
("Map mode", ""),
("Translate mode", "Fordító mód"),
("Use temporary password", "Ideiglenes jelszó használata"),
("Use permanent password", "Állandó jelszó használata"),
("Use both passwords", "Mindkét jelszó használata"),
("Set permanent password", "Állandó jelszó beállítása"),
("Set temporary password length", "Ideiglenes jelszó hosszának beállítása"),
("Enable Remote Restart", "Távoli újraindítás engedélyezése"),
("Allow remote restart", "Távoli újraindítás engedélyezése"),
("Restart Remote Device", "Távoli eszköz újraindítása"),
@ -343,7 +341,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Enable hardware codec", "Hardveres kodek engedélyezése"),
("Unlock Security Settings", "Biztonsági beállítások feloldása"),
("Enable Audio", "Hang engedélyezése"),
("Temporary Password Length", "Ideiglenes jelszó hossza"),
("Unlock Network Settings", "Hálózati beállítások feloldása"),
("Server", "Szerver"),
("Direct IP Access", "Közvetlen IP hozzáférés"),
@ -394,5 +391,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Accept sessions via click", ""),
("Accept sessions via both", ""),
("Please wait for the remote side to accept your session request...", ""),
("One-time Password", ""),
("Use one-time password", ""),
("One-time password length", ""),
].iter().cloned().collect();
}

View File

@ -303,11 +303,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Legacy mode", "Mode lama"),
("Map mode", "Mode peta"),
("Translate mode", "Mode terjemahan"),
("Use temporary password", "Gunakan kata sandi sementara"),
("Use permanent password", "Gunakan kata sandi permanaen"),
("Use both passwords", "Gunakan kedua kata sandi "),
("Set permanent password", "Setel kata sandi permanen"),
("Set temporary password length", "Setel panjang kata sandi sementara"),
("Enable Remote Restart", "Aktifkan Restart Jarak Jauh"),
("Allow remote restart", "Ijinkan Restart Jarak Jauh"),
("Restart Remote Device", "Restart Perangkat Jarak Jauh"),
@ -343,7 +341,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Enable hardware codec", "Aktifkan codec perangkat keras"),
("Unlock Security Settings", "Buka Kunci Pengaturan Keamanan"),
("Enable Audio", "Aktifkan Audio"),
("Temporary Password Length", "Panjang Kata Sandi Sementara"),
("Unlock Network Settings", "Buka Kunci Pengaturan Jaringan"),
("Server", "Server"),
("Direct IP Access", "Direct IP Access"),
@ -394,5 +391,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Accept sessions via click", ""),
("Accept sessions via both", ""),
("Please wait for the remote side to accept your session request...", ""),
("One-time Password", ""),
("Use one-time password", ""),
("One-time password length", ""),
].iter().cloned().collect();
}

View File

@ -303,11 +303,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Legacy mode", "Modalità legacy"),
("Map mode", "Modalità mappa"),
("Translate mode", "Modalità di traduzione"),
("Use temporary password", "Usa password temporanea"),
("Use permanent password", "Usa password permanente"),
("Use both passwords", "Usa entrambe le password"),
("Set permanent password", "Imposta password permanente"),
("Set temporary password length", "Imposta lunghezza passwod temporanea"),
("Enable Remote Restart", "Abilita riavvio da remoto"),
("Allow remote restart", "Consenti riavvio da remoto"),
("Restart Remote Device", "Riavvia dispositivo remoto"),
@ -343,7 +341,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Enable hardware codec", "Abilita codec hardware"),
("Unlock Security Settings", "Sblocca impostazioni di sicurezza"),
("Enable Audio", "Abilita audio"),
("Temporary Password Length", "Lunghezza password temporanea"),
("Unlock Network Settings", "Sblocca impostazioni di rete"),
("Server", ""),
("Direct IP Access", "Accesso IP diretto"),
@ -394,5 +391,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Accept sessions via click", ""),
("Accept sessions via both", ""),
("Please wait for the remote side to accept your session request...", ""),
("One-time Password", ""),
("Use one-time password", ""),
("One-time password length", ""),
].iter().cloned().collect();
}

View File

@ -303,11 +303,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Legacy mode", ""),
("Map mode", ""),
("Translate mode", ""),
("Use temporary password", "使い捨てのパスワードを使用"),
("Use permanent password", "固定のパスワードを使用"),
("Use both passwords", "どちらのパスワードも使用"),
("Set permanent password", "固定のパスワードを設定"),
("Set temporary password length", "使い捨てのパスワードの長さを設定"),
("Enable Remote Restart", "リモートからの再起動を有効化"),
("Allow remote restart", "リモートからの再起動を許可"),
("Restart Remote Device", "リモートの端末を再起動"),
@ -343,7 +341,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Enable hardware codec", ""),
("Unlock Security Settings", ""),
("Enable Audio", ""),
("Temporary Password Length", ""),
("Unlock Network Settings", ""),
("Server", ""),
("Direct IP Access", ""),
@ -394,5 +391,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Accept sessions via click", ""),
("Accept sessions via both", ""),
("Please wait for the remote side to accept your session request...", ""),
("One-time Password", ""),
("Use one-time password", ""),
("One-time password length", ""),
].iter().cloned().collect();
}

View File

@ -303,11 +303,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Legacy mode", ""),
("Map mode", ""),
("Translate mode", ""),
("Use temporary password", "임시 비밀번호 사용"),
("Use permanent password", "영구 비밀번호 사용"),
("Use both passwords", "두 비밀번호 (임시/영구) 사용"),
("Set permanent password", "영구 비밀번호 설정"),
("Set temporary password length", "임시 비밀번호 길이 설정"),
("Enable Remote Restart", "원격지 재시작 활성화"),
("Allow remote restart", "원격지 재시작 허용"),
("Restart Remote Device", "원격 기기 재시작"),
@ -343,7 +341,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Enable hardware codec", ""),
("Unlock Security Settings", ""),
("Enable Audio", ""),
("Temporary Password Length", ""),
("Unlock Network Settings", ""),
("Server", ""),
("Direct IP Access", ""),
@ -394,5 +391,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Accept sessions via click", ""),
("Accept sessions via both", ""),
("Please wait for the remote side to accept your session request...", ""),
("One-time Password", ""),
("Use one-time password", ""),
("One-time password length", ""),
].iter().cloned().collect();
}

View File

@ -303,11 +303,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Legacy mode", ""),
("Map mode", ""),
("Translate mode", ""),
("Use temporary password", "Уақытша құпия сөзді қолдану"),
("Use permanent password", "Тұрақты құпия сөзді қолдану"),
("Use both passwords", "Қос құпия сөзді қолдану"),
("Set permanent password", "Тұрақты құпия сөзді орнату"),
("Set temporary password length", "Уақытша құпия сөздің ұзындығын орнату"),
("Enable Remote Restart", "Қашықтан қайта-қосуды іске қосу"),
("Allow remote restart", "Қашықтан қайта-қосуды рұқсат ету"),
("Restart Remote Device", "Қашықтағы құрылғыны қайта-қосу"),
@ -343,7 +341,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Enable hardware codec", ""),
("Unlock Security Settings", ""),
("Enable Audio", ""),
("Temporary Password Length", ""),
("Unlock Network Settings", ""),
("Server", ""),
("Direct IP Access", ""),
@ -394,5 +391,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Accept sessions via click", ""),
("Accept sessions via both", ""),
("Please wait for the remote side to accept your session request...", ""),
("One-time Password", ""),
("Use one-time password", ""),
("One-time password length", ""),
].iter().cloned().collect();
}

View File

@ -303,11 +303,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Legacy mode", "Tryb kompatybilności wstecznej (legacy)"),
("Map mode", "Tryb mapowania"),
("Translate mode", "Tryb translacji"),
("Use temporary password", "Użyj tymczasowego hasła"),
("Use permanent password", "Użyj hasła permanentnego"),
("Use both passwords", "Użyj obu haseł"),
("Set permanent password", "Ustaw hasło permanentne"),
("Set temporary password length", "Ustaw długość hasła tymczasowego"),
("Enable Remote Restart", "Włącz Zdalne Restartowanie"),
("Allow remote restart", "Zezwól na zdalne restartowanie"),
("Restart Remote Device", "Zrestartuj Zdalne Urządzenie"),
@ -343,7 +341,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Enable hardware codec", "Włącz wsparcie sprzętowe dla kodeków"),
("Unlock Security Settings", "Odblokuj Ustawienia Zabezpieczeń"),
("Enable Audio", "Włącz Dźwięk"),
("Temporary Password Length", "Długość hasła tymaczowego"),
("Unlock Network Settings", "Odblokuj ustawienia Sieciowe"),
("Server", "Serwer"),
("Direct IP Access", "Bezpośredni Adres IP"),
@ -394,5 +391,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Accept sessions via click", ""),
("Accept sessions via both", ""),
("Please wait for the remote side to accept your session request...", ""),
("One-time Password", ""),
("Use one-time password", ""),
("One-time password length", ""),
].iter().cloned().collect();
}

View File

@ -303,11 +303,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Legacy mode", ""),
("Map mode", ""),
("Translate mode", ""),
("Use temporary password", "Utilizar palavra-chave temporária"),
("Use permanent password", "Utilizar palavra-chave permanente"),
("Use both passwords", "Utilizar ambas as palavras-chave"),
("Set permanent password", "Definir palavra-chave permanente"),
("Set temporary password length", "Definir tamanho de palavra-chave temporária"),
("Enable Remote Restart", "Activar reiniciar remoto"),
("Allow remote restart", "Permitir reiniciar remoto"),
("Restart Remote Device", "Reiniciar Dispositivo Remoto"),
@ -343,7 +341,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Enable hardware codec", ""),
("Unlock Security Settings", ""),
("Enable Audio", ""),
("Temporary Password Length", ""),
("Unlock Network Settings", ""),
("Server", ""),
("Direct IP Access", ""),
@ -394,5 +391,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Accept sessions via click", ""),
("Accept sessions via both", ""),
("Please wait for the remote side to accept your session request...", ""),
("One-time Password", ""),
("Use one-time password", ""),
("One-time password length", ""),
].iter().cloned().collect();
}

View File

@ -303,11 +303,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Legacy mode", "Modo legado"),
("Map mode", "Modo mapa"),
("Translate mode", "Modo traduzido"),
("Use temporary password", "Utilizar senha temporária"),
("Use permanent password", "Utilizar senha permanente"),
("Use both passwords", "Utilizar ambas as senhas"),
("Set permanent password", "Configurar senha permanente"),
("Set temporary password length", "Configurar extensão da senha temporária"),
("Enable Remote Restart", "Habilitar reinicialização remota"),
("Allow remote restart", "Permitir reinicialização remota"),
("Restart Remote Device", "Reiniciar dispositivo remoto"),
@ -343,7 +341,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Enable hardware codec", "Habilitar codec de hardware"),
("Unlock Security Settings", "Desabilitar configurações de segurança"),
("Enable Audio", "Habilitar áudio"),
("Temporary Password Length", "Extensão da senha temporária"),
("Unlock Network Settings", "Desbloquear configurações de rede"),
("Server", "Servidor"),
("Direct IP Access", "Acesso direto por IP"),
@ -394,5 +391,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Accept sessions via click", ""),
("Accept sessions via both", ""),
("Please wait for the remote side to accept your session request...", ""),
("One-time Password", ""),
("Use one-time password", ""),
("One-time password length", ""),
].iter().cloned().collect();
}

View File

@ -303,11 +303,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Legacy mode", "Устаревший режим"),
("Map mode", "Режим сопоставления"),
("Translate mode", "Режим перевода"),
("Use temporary password", "Использовать временный пароль"),
("Use permanent password", "Использовать постоянный пароль"),
("Use both passwords", "Использовать оба пароля"),
("Set permanent password", "Установить постоянный пароль"),
("Set temporary password length", "Длина временного пароля"),
("Enable Remote Restart", "Включить удалённый перезапуск"),
("Allow remote restart", "Разрешить удалённый перезапуск"),
("Restart Remote Device", "Перезапустить удалённое устройство"),
@ -343,7 +341,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Enable hardware codec", "Использовать аппаратный кодек"),
("Unlock Security Settings", "Разблокировать настройки безопасности"),
("Enable Audio", "Включить звук"),
("Temporary Password Length", "Длинна временного пароля"),
("Unlock Network Settings", "Разблокировать настройки соединения"),
("Server", "Сервер"),
("Direct IP Access", "Прямой IP-доступ"),
@ -394,5 +391,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Accept sessions via click", ""),
("Accept sessions via both", ""),
("Please wait for the remote side to accept your session request...", ""),
("One-time Password", ""),
("Use one-time password", ""),
("One-time password length", ""),
].iter().cloned().collect();
}

View File

@ -303,11 +303,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Legacy mode", ""),
("Map mode", ""),
("Translate mode", ""),
("Use temporary password", ""),
("Use permanent password", ""),
("Use both passwords", ""),
("Set permanent password", ""),
("Set temporary password length", ""),
("Enable Remote Restart", ""),
("Allow remote restart", ""),
("Restart Remote Device", ""),
@ -343,7 +341,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Enable hardware codec", ""),
("Unlock Security Settings", ""),
("Enable Audio", ""),
("Temporary Password Length", ""),
("Unlock Network Settings", ""),
("Server", ""),
("Direct IP Access", ""),
@ -394,5 +391,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Accept sessions via click", ""),
("Accept sessions via both", ""),
("Please wait for the remote side to accept your session request...", ""),
("One-time Password", ""),
("Use one-time password", ""),
("One-time password length", ""),
].iter().cloned().collect();
}

View File

@ -303,11 +303,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Legacy mode", ""),
("Map mode", ""),
("Translate mode", ""),
("Use temporary password", ""),
("Use permanent password", ""),
("Use both passwords", ""),
("Set permanent password", ""),
("Set temporary password length", ""),
("Enable Remote Restart", ""),
("Allow remote restart", ""),
("Restart Remote Device", ""),
@ -343,7 +341,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Enable hardware codec", ""),
("Unlock Security Settings", ""),
("Enable Audio", ""),
("Temporary Password Length", ""),
("Unlock Network Settings", ""),
("Server", ""),
("Direct IP Access", ""),
@ -394,5 +391,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Accept sessions via click", ""),
("Accept sessions via both", ""),
("Please wait for the remote side to accept your session request...", ""),
("One-time Password", ""),
("Use one-time password", ""),
("One-time password length", ""),
].iter().cloned().collect();
}

View File

@ -303,11 +303,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Legacy mode", "Eski mod"),
("Map mode", "Haritalama modu"),
("Translate mode", "Çeviri modu"),
("Use temporary password", "Geçici şifre kullan"),
("Use permanent password", "Kalıcı şifre kullan"),
("Use both passwords", "İki şifreyide kullan"),
("Set permanent password", "Kalıcı şifre oluştur"),
("Set temporary password length", "Geçici şifre oluştur"),
("Enable Remote Restart", "Uzaktan yeniden başlatmayı aktif et"),
("Allow remote restart", "Uzaktan yeniden başlatmaya izin ver"),
("Restart Remote Device", "Uzaktaki cihazı yeniden başlat"),
@ -343,7 +341,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Enable hardware codec", "Donanımsal codec aktif et"),
("Unlock Security Settings", "Güvenlik Ayarlarını"),
("Enable Audio", "Sesi Aktif Et"),
("Temporary Password Length", "Geçici Şifre Uzunluğu"),
("Unlock Network Settings", "Ağ Ayarlarını"),
("Server", "Sunucu"),
("Direct IP Access", "Direk IP Erişimi"),
@ -394,5 +391,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Accept sessions via click", ""),
("Accept sessions via both", ""),
("Please wait for the remote side to accept your session request...", ""),
("One-time Password", ""),
("Use one-time password", ""),
("One-time password length", ""),
].iter().cloned().collect();
}

View File

@ -303,11 +303,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Legacy mode", "傳統模式"),
("Map mode", "11傳輸"),
("Translate mode", "翻譯模式"),
("Use temporary password", "使用臨時密碼"),
("Use permanent password", "使用固定密碼"),
("Use both passwords", "同時使用兩種密碼"),
("Set permanent password", "設定固定密碼"),
("Set temporary password length", "設定臨時密碼長度"),
("Enable Remote Restart", "允許遠程重啓"),
("Allow remote restart", "允許遠程重啓"),
("Restart Remote Device", "重啓遠程電腦"),
@ -343,7 +341,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Enable hardware codec", "使用硬件編解碼"),
("Unlock Security Settings", "解鎖安全設置"),
("Enable Audio", "允許傳輸音頻"),
("Temporary Password Length", "臨時密碼長度"),
("Unlock Network Settings", "解鎖網絡設置"),
("Server", "服務器"),
("Direct IP Access", "IP直接訪問"),
@ -394,5 +391,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Accept sessions via click", "只允許點擊訪問"),
("Accept sessions via both", "允許密碼或點擊訪問"),
("Please wait for the remote side to accept your session request...", "請等待對方接受你的連接..."),
("One-time Password", "一次性密碼"),
("Use one-time password", "使用一次性密碼"),
("One-time password length", "一次性密碼長度"),
].iter().cloned().collect();
}

View File

@ -303,11 +303,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Legacy mode", ""),
("Map mode", ""),
("Translate mode", ""),
("Use temporary password", "Використовувати тимчасовий пароль"),
("Use permanent password", "Використовувати постійний пароль"),
("Use both passwords", "Використовувати обидва паролі"),
("Set permanent password", "Встановити постійний пароль"),
("Set temporary password length", "Довжина тимчасового пароля"),
("Enable Remote Restart", "Увімкнути віддалений перезапуск"),
("Allow remote restart", "Дозволити віддалений перезапуск"),
("Restart Remote Device", "Перезапустити віддалений пристрій"),
@ -343,7 +341,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Enable hardware codec", "Увімкнути апаратний кодек"),
("Unlock Security Settings", "Розблокувати налаштування безпеки"),
("Enable Audio", "Вімкнути аудіо"),
("Temporary Password Length", "Довжина тимчасового пароля"),
("Unlock Network Settings", "Розблокувати мережеві налаштування"),
("Server", "Сервер"),
("Direct IP Access", "Прямий IP доступ"),
@ -394,5 +391,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Accept sessions via click", ""),
("Accept sessions via both", ""),
("Please wait for the remote side to accept your session request...", ""),
("One-time Password", ""),
("Use one-time password", ""),
("One-time password length", ""),
].iter().cloned().collect();
}

View File

@ -303,11 +303,9 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Legacy mode", ""),
("Map mode", ""),
("Translate mode", ""),
("Use temporary password", "Sử dụng mật khẩu tạm thời"),
("Use permanent password", "Sử dụng mật khẩu vĩnh viễn"),
("Use both passwords", "Sử dụng cả hai mật khẩu"),
("Set permanent password", "Đặt mật khẩu vĩnh viễn"),
("Set temporary password length", "Đặt chiều dài của mật khẩu tạm thời"),
("Enable Remote Restart", "Bật khởi động lại từ xa"),
("Allow remote restart", "Cho phép khởi động lại từ xa"),
("Restart Remote Device", "Khởi động lại thiết bị từ xa"),
@ -343,7 +341,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Enable hardware codec", ""),
("Unlock Security Settings", ""),
("Enable Audio", ""),
("Temporary Password Length", ""),
("Unlock Network Settings", ""),
("Server", ""),
("Direct IP Access", ""),
@ -394,5 +391,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("Accept sessions via click", ""),
("Accept sessions via both", ""),
("Please wait for the remote side to accept your session request...", ""),
("One-time Password", ""),
("Use one-time password", ""),
("One-time password length", ""),
].iter().cloned().collect();
}

View File

@ -14,7 +14,8 @@ use hbb_common::{
futures::{SinkExt, StreamExt},
get_time, get_version_number,
message_proto::{option_message::BoolOption, permission_info::Permission},
password_security as password, sleep, timeout,
password_security::{self as password, ApproveMode},
sleep, timeout,
tokio::{
net::TcpStream,
sync::mpsc,
@ -1046,7 +1047,9 @@ impl Connection {
}
if !crate::is_ip(&lr.username) && lr.username != Config::get_id() {
self.send_login_error("Offline").await;
} else if Config::get_option("approve-mode") == "click" {
} else if password::approve_mode() == ApproveMode::Click
|| password::approve_mode() == ApproveMode::Both && !password::has_valid_password()
{
self.try_start_cm(lr.my_id, lr.my_name, false);
if hbb_common::get_version_number(&lr.version)
>= hbb_common::get_version_number("1.2.0")
@ -1054,6 +1057,11 @@ impl Connection {
self.send_login_error("No Password Access").await;
}
return true;
} else if password::approve_mode() == ApproveMode::Password
&& !password::has_valid_password()
{
self.send_login_error("Connection not allowed").await;
return false;
} else if self.is_of_recent_session() {
self.try_start_cm(lr.my_id, lr.my_name, true);
self.send_logon_response().await;
@ -1063,10 +1071,6 @@ impl Connection {
} else if lr.password.is_empty() {
self.try_start_cm(lr.my_id, lr.my_name, false);
} else {
if !password::has_valid_password() {
self.send_login_error("Connection not allowed").await;
return false;
}
let mut failure = LOGIN_FAILURES
.lock()
.unwrap()

View File

@ -850,7 +850,7 @@ class TemporaryPasswordLengthMenu: Reactor.Component {
var me = this;
var method = handler.get_option('verification-method');
self.timer(1ms, function() { me.toggleMenuState() });
return <li disabled={ method == 'use-permanent-password' ? "true" : "false" }>{translate("Set temporary password length")}
return <li disabled={ method == 'use-permanent-password' ? "true" : "false" }>{translate("One-time password length")}
<menu #temporary-password-length>
<li #temporary-password-length-6><span>{svg_checkmark}</span>6</li>
<li #temporary-password-length-8><span>{svg_checkmark}</span>8</li>
@ -891,7 +891,7 @@ class PasswordArea: Reactor.Component {
self.timer(1ms, function() { me.toggleMenuState() });
return
<div .your-desktop>
<div>{translate('Password')}</div>
<div>{translate('One-time Password')}</div>
<div .password style="flow:horizontal">
{this.renderPop()}
<PasswordEyeArea />
@ -909,7 +909,7 @@ class PasswordArea: Reactor.Component {
<li #approve-mode-click><span>{svg_checkmark}</span>{translate('Accept sessions via click')}</li>
<li #approve-mode-both><span>{svg_checkmark}</span>{translate('Accept sessions via both')}</li>
{ !show_password ? '' : <div .separator /> }
{ !show_password ? '' : <li #use-temporary-password><span>{svg_checkmark}</span>{translate('Use temporary password')}</li> }
{ !show_password ? '' : <li #use-temporary-password><span>{svg_checkmark}</span>{translate('Use one-time password')}</li> }
{ !show_password ? '' : <li #use-permanent-password><span>{svg_checkmark}</span>{translate('Use permanent password')}</li> }
{ !show_password ? '' : <li #use-both-passwords><span>{svg_checkmark}</span>{translate('Use both passwords')}</li> }
{ !show_password ? '' : <div .separator /> }