mirror of
https://github.com/rustdesk/rustdesk.git
synced 2025-06-07 09:52:49 +08:00
verification code, auto submit (#6822)
Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
parent
396d7680d3
commit
159c883bf3
@ -615,6 +615,7 @@ Future<bool?> verificationCodeDialog(
|
|||||||
var autoLogin = true;
|
var autoLogin = true;
|
||||||
var isInProgress = false;
|
var isInProgress = false;
|
||||||
String? errorText;
|
String? errorText;
|
||||||
|
String preCode = '';
|
||||||
|
|
||||||
final code = TextEditingController();
|
final code = TextEditingController();
|
||||||
final focusNode = FocusNode()..requestFocus();
|
final focusNode = FocusNode()..requestFocus();
|
||||||
@ -625,12 +626,6 @@ Future<bool?> verificationCodeDialog(
|
|||||||
return code.text.length >= 6;
|
return code.text.length >= 6;
|
||||||
}
|
}
|
||||||
|
|
||||||
code.addListener(() {
|
|
||||||
if (errorText != null) {
|
|
||||||
setState(() => errorText = null);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
void onVerify() async {
|
void onVerify() async {
|
||||||
if (!validate()) {
|
if (!validate()) {
|
||||||
setState(
|
setState(
|
||||||
@ -671,6 +666,19 @@ Future<bool?> verificationCodeDialog(
|
|||||||
setState(() => isInProgress = false);
|
setState(() => isInProgress = false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
code.addListener(() {
|
||||||
|
if (errorText != null) {
|
||||||
|
setState(() => errorText = null);
|
||||||
|
}
|
||||||
|
if (preCode.length != 6 && code.text.length == 6) {
|
||||||
|
onVerify();
|
||||||
|
}
|
||||||
|
if (!isEmailVerification && preCode.length != 10 && code.text.length == 10) {
|
||||||
|
onVerify();
|
||||||
|
}
|
||||||
|
preCode = code.text;
|
||||||
|
});
|
||||||
|
|
||||||
return CustomAlertDialog(
|
return CustomAlertDialog(
|
||||||
title: Text(translate("Verification code")),
|
title: Text(translate("Verification code")),
|
||||||
contentBoxConstraints: BoxConstraints(maxWidth: 300),
|
contentBoxConstraints: BoxConstraints(maxWidth: 300),
|
||||||
|
Loading…
Reference in New Issue
Block a user