Trigger regular login when loginKey derivation fails

This commit is contained in:
Neeraj Gupta 2023-11-20 13:50:25 +05:30
parent f910da0964
commit 1da9cd6f35

View file

@ -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,
);
}
}