Merge pull request #2256 from 21pages/password

allow clear permanent password
This commit is contained in:
RustDesk 2022-11-21 20:03:03 +08:00 committed by GitHub
commit 3162c92333
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
29 changed files with 44 additions and 10 deletions

View File

@ -486,7 +486,7 @@ void setPasswordDialog() async {
errMsg1 = ""; errMsg1 = "";
}); });
final pass = p0.text.trim(); final pass = p0.text.trim();
if (pass.length < 6) { if (pass.length < 6 && pass.isNotEmpty) {
setState(() { setState(() {
errMsg0 = translate("Too short, at least 6 characters."); errMsg0 = translate("Too short, at least 6 characters.");
}); });

View File

@ -304,7 +304,9 @@ class _CmHeaderState extends State<_CmHeader>
void initState() { void initState() {
super.initState(); super.initState();
_timer = Timer.periodic(Duration(seconds: 1), (_) { _timer = Timer.periodic(Duration(seconds: 1), (_) {
if (!client.disconnected) _time.value = _time.value + 1; if (client.authorized && !client.disconnected) {
_time.value = _time.value + 1;
}
}); });
} }
@ -358,12 +360,15 @@ class _CmHeaderState extends State<_CmHeader>
FittedBox( FittedBox(
child: Row( child: Row(
children: [ children: [
Text(client.disconnected Text(client.authorized
? translate("Disconnected") ? client.disconnected
: translate("Connected")) ? translate("Disconnected")
: translate("Connected")
: "${translate("Request access to your device")}...")
.marginOnly(right: 8.0), .marginOnly(right: 8.0),
Obx(() => Text( if (client.authorized)
formatDurationToTime(Duration(seconds: _time.value)))) Obx(() => Text(
formatDurationToTime(Duration(seconds: _time.value))))
], ],
)) ))
], ],

View File

@ -393,5 +393,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("One-time Password", ""), ("One-time Password", ""),
("Use one-time password", ""), ("Use one-time password", ""),
("One-time password length", ""), ("One-time password length", ""),
("Request access to your device", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -394,5 +394,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("One-time Password", "一次性密码"), ("One-time Password", "一次性密码"),
("Use one-time password", "使用一次性密码"), ("Use one-time password", "使用一次性密码"),
("One-time password length", "一次性密码长度"), ("One-time password length", "一次性密码长度"),
("Request access to your device", "请求访问你的设备"),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -394,5 +394,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("One-time Password", ""), ("One-time Password", ""),
("Use one-time password", ""), ("Use one-time password", ""),
("One-time password length", ""), ("One-time password length", ""),
("Request access to your device", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -394,5 +394,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("One-time Password", ""), ("One-time Password", ""),
("Use one-time password", ""), ("Use one-time password", ""),
("One-time password length", ""), ("One-time password length", ""),
("Request access to your device", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -394,5 +394,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("One-time Password", ""), ("One-time Password", ""),
("Use one-time password", ""), ("Use one-time password", ""),
("One-time password length", ""), ("One-time password length", ""),
("Request access to your device", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -394,5 +394,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("One-time Password", ""), ("One-time Password", ""),
("Use one-time password", ""), ("Use one-time password", ""),
("One-time password length", ""), ("One-time password length", ""),
("Request access to your device", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -394,5 +394,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("One-time Password", ""), ("One-time Password", ""),
("Use one-time password", ""), ("Use one-time password", ""),
("One-time password length", ""), ("One-time password length", ""),
("Request access to your device", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -393,5 +393,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("One-time Password", "رمز عبور یکبار مصرف"), ("One-time Password", "رمز عبور یکبار مصرف"),
("Use one-time password", "استفاده از رمز عبور یکبار مصرف"), ("Use one-time password", "استفاده از رمز عبور یکبار مصرف"),
("One-time password length", "طول رمز عبور یکبار مصرف"), ("One-time password length", "طول رمز عبور یکبار مصرف"),
("Request access to your device", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -394,5 +394,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("One-time Password", ""), ("One-time Password", ""),
("Use one-time password", ""), ("Use one-time password", ""),
("One-time password length", ""), ("One-time password length", ""),
("Request access to your device", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -394,5 +394,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("One-time Password", ""), ("One-time Password", ""),
("Use one-time password", ""), ("Use one-time password", ""),
("One-time password length", ""), ("One-time password length", ""),
("Request access to your device", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -394,5 +394,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("One-time Password", ""), ("One-time Password", ""),
("Use one-time password", ""), ("Use one-time password", ""),
("One-time password length", ""), ("One-time password length", ""),
("Request access to your device", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -394,5 +394,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("One-time Password", "Password monouso"), ("One-time Password", "Password monouso"),
("Use one-time password", "Usa password monouso"), ("Use one-time password", "Usa password monouso"),
("One-time password length", "Lunghezza password monouso"), ("One-time password length", "Lunghezza password monouso"),
("Request access to your device", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -394,5 +394,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("One-time Password", ""), ("One-time Password", ""),
("Use one-time password", ""), ("Use one-time password", ""),
("One-time password length", ""), ("One-time password length", ""),
("Request access to your device", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -394,5 +394,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("One-time Password", ""), ("One-time Password", ""),
("Use one-time password", ""), ("Use one-time password", ""),
("One-time password length", ""), ("One-time password length", ""),
("Request access to your device", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -394,5 +394,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("One-time Password", ""), ("One-time Password", ""),
("Use one-time password", ""), ("Use one-time password", ""),
("One-time password length", ""), ("One-time password length", ""),
("Request access to your device", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -394,5 +394,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("One-time Password", ""), ("One-time Password", ""),
("Use one-time password", ""), ("Use one-time password", ""),
("One-time password length", ""), ("One-time password length", ""),
("Request access to your device", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -394,5 +394,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("One-time Password", ""), ("One-time Password", ""),
("Use one-time password", ""), ("Use one-time password", ""),
("One-time password length", ""), ("One-time password length", ""),
("Request access to your device", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -394,5 +394,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("One-time Password", ""), ("One-time Password", ""),
("Use one-time password", ""), ("Use one-time password", ""),
("One-time password length", ""), ("One-time password length", ""),
("Request access to your device", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -394,5 +394,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("One-time Password", ""), ("One-time Password", ""),
("Use one-time password", ""), ("Use one-time password", ""),
("One-time password length", ""), ("One-time password length", ""),
("Request access to your device", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -394,5 +394,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("One-time Password", ""), ("One-time Password", ""),
("Use one-time password", ""), ("Use one-time password", ""),
("One-time password length", ""), ("One-time password length", ""),
("Request access to your device", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -394,5 +394,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("One-time Password", ""), ("One-time Password", ""),
("Use one-time password", ""), ("Use one-time password", ""),
("One-time password length", ""), ("One-time password length", ""),
("Request access to your device", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -394,5 +394,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("One-time Password", ""), ("One-time Password", ""),
("Use one-time password", ""), ("Use one-time password", ""),
("One-time password length", ""), ("One-time password length", ""),
("Request access to your device", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -394,5 +394,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("One-time Password", "一次性密碼"), ("One-time Password", "一次性密碼"),
("Use one-time password", "使用一次性密碼"), ("Use one-time password", "使用一次性密碼"),
("One-time password length", "一次性密碼長度"), ("One-time password length", "一次性密碼長度"),
("Request access to your device", "請求訪問你的設備"),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -394,5 +394,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("One-time Password", ""), ("One-time Password", ""),
("Use one-time password", ""), ("Use one-time password", ""),
("One-time password length", ""), ("One-time password length", ""),
("Request access to your device", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -394,5 +394,6 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("One-time Password", ""), ("One-time Password", ""),
("Use one-time password", ""), ("Use one-time password", ""),
("One-time password length", ""), ("One-time password length", ""),
("Request access to your device", ""),
].iter().cloned().collect(); ].iter().cloned().collect();
} }

View File

@ -41,7 +41,10 @@ class Body: Reactor.Component
<div> <div>
<div .id style="font-weight: bold; font-size: 1.2em;">{c.name}</div> <div .id style="font-weight: bold; font-size: 1.2em;">{c.name}</div>
<div .id>({c.peer_id})</div> <div .id>({c.peer_id})</div>
<div style="margin-top: 1.2em">{disconnected ? translate('Disconnected') : translate('Connected')} {" "} <span #time>{getElaspsed(c.time, c.now)}</span></div> <div style="margin-top: 1.2em">{auth
? <span>{disconnected ? translate('Disconnected') : translate('Connected')}{" "}<span #time>{getElaspsed(c.time, c.now)}</span></span>
: <span>{translate('Request access to your device')}{"..."}</span>}
</div>
</div> </div>
</div> </div>
<div /> <div />
@ -472,12 +475,13 @@ function updateTime() {
self.timer(1s, function() { self.timer(1s, function() {
var now = new Date(); var now = new Date();
connections.map(function(c) { connections.map(function(c) {
if (!c.authorized) c.time = now;
if (!c.disconnected) c.now = now; if (!c.disconnected) c.now = now;
}); });
var el = $(#time); var el = $(#time);
if (el) { if (el) {
var c = connections[body.cur]; var c = connections[body.cur];
if (c && !c.disconnected) { if (c && c.authorized && !c.disconnected) {
el.text = getElaspsed(c.time, c.now); el.text = getElaspsed(c.time, c.now);
} }
} }

View File

@ -958,7 +958,7 @@ class PasswordArea: Reactor.Component {
if (!res) return; if (!res) return;
var p0 = (res.password || "").trim(); var p0 = (res.password || "").trim();
var p1 = (res.confirmation || "").trim(); var p1 = (res.confirmation || "").trim();
if (p0.length < 6) { if (p0.length < 6 && p0.length != 0) {
return translate("Too short, at least 6 characters."); return translate("Too short, at least 6 characters.");
} }
if (p0 != p1) { if (p0 != p1) {