mirror of
https://github.com/rustdesk/rustdesk.git
synced 2024-11-27 23:19:02 +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 isInProgress = false;
|
||||
String? errorText;
|
||||
String preCode = '';
|
||||
|
||||
final code = TextEditingController();
|
||||
final focusNode = FocusNode()..requestFocus();
|
||||
@ -625,12 +626,6 @@ Future<bool?> verificationCodeDialog(
|
||||
return code.text.length >= 6;
|
||||
}
|
||||
|
||||
code.addListener(() {
|
||||
if (errorText != null) {
|
||||
setState(() => errorText = null);
|
||||
}
|
||||
});
|
||||
|
||||
void onVerify() async {
|
||||
if (!validate()) {
|
||||
setState(
|
||||
@ -671,6 +666,19 @@ Future<bool?> verificationCodeDialog(
|
||||
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(
|
||||
title: Text(translate("Verification code")),
|
||||
contentBoxConstraints: BoxConstraints(maxWidth: 300),
|
||||
|
Loading…
Reference in New Issue
Block a user