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 verificationCodeDialog( var autoLogin = true; var isInProgress = false; String? errorText; + String preCode = ''; final code = TextEditingController(); final focusNode = FocusNode()..requestFocus(); @@ -625,12 +626,6 @@ Future 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 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),