Skip to content

An open-source remote desktop application designed for self-hosting, as an alternative to TeamViewer.

verification code, auto submit (#6822)

fufesou159c883bf382
diff --git a/flutter/lib/common/widgets/login.dart b/flutter/lib/common/widgets/login.dart
index 5ce10be4f..fc4f80e96 100644
--- a/flutter/lib/common/widgets/login.dart
+++ b/flutter/lib/common/widgets/login.dart
@@ -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),