The error in the background is potentially confusing too

This commit is contained in:
Manav Rathi
2024-06-20 13:43:22 +05:30
parent 685a3ca4c7
commit edceebd8fb

View File

@@ -32,7 +32,8 @@ export interface VerifyMasterPasswordFormProps {
/**
* Called when the user enters an incorrect password.
*
* Optional.
* Optional. If present, this function will be called _instead_ of
* performing the default behaviour (showing an "incorrect password" error).
*/
onIncorrectPassword?: () => void;
}
@@ -104,8 +105,8 @@ export default function VerifyMasterPasswordForm({
setFieldError(t("WEAK_DEVICE"));
break;
case CustomError.INCORRECT_PASSWORD:
setFieldError(t("INCORRECT_PASSPHRASE"));
onIncorrectPassword && onIncorrectPassword();
if (onIncorrectPassword) onIncorrectPassword();
else setFieldError(t("INCORRECT_PASSPHRASE"));
break;
default:
setFieldError(`${t("UNKNOWN_ERROR")} ${e.message}`);