فهرست منبع

Trigger regular login when loginKey derivation fails

Neeraj Gupta 1 سال پیش
والد
کامیت
1da9cd6f35
1فایلهای تغییر یافته به همراه19 افزوده شده و 7 حذف شده
  1. 19 7
      lib/ui/account/login_pwd_verification_page.dart

+ 19 - 7
lib/ui/account/login_pwd_verification_page.dart

@@ -139,9 +139,19 @@ class _LoginPasswordVerificationPageState
         }
       }
     } catch (e, s) {
-      _logger.severe('error while verifying password', e, s);
+      _logger.info('error during loginViaPassword', e);
       await dialog.hide();
-      if (e is KeyDerivationError || e is LoginKeyDerivationError) {
+      if (e is LoginKeyDerivationError) {
+        _logger.severe('loginKey derivation error', e, s);
+        // LoginKey err, perform regular login via ott verification
+        await UserService.instance.sendOtt(
+          context,
+          email!,
+          isCreateAccountScreen: true,
+        );
+        return;
+      } else if (e is KeyDerivationError) {
+        // device is not powerful enough to perform derive key
         final dialogChoice = await showChoiceDialog(
           context,
           title: S.of(context).recreatePasswordTitle,
@@ -156,12 +166,14 @@ class _LoginPasswordVerificationPageState
           );
         }
         return;
+      } else {
+        _logger.severe('unexpected error while verifying password', e, s);
+        await _showContactSupportDialog(
+          context,
+          S.of(context).oops,
+          S.of(context).verificationFailedPleaseTryAgain,
+        );
       }
-      await _showContactSupportDialog(
-        context,
-        S.of(context).oops,
-        S.of(context).verificationFailedPleaseTryAgain,
-      );
     }
   }