Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Scope

Manav Rathi334a996357b7
diff --git a/web/packages/accounts/components/VerifyMasterPasswordForm.tsx b/web/packages/accounts/components/VerifyMasterPasswordForm.tsx
index b6a812754f..2a7e576616 100644
--- a/web/packages/accounts/components/VerifyMasterPasswordForm.tsx
+++ b/web/packages/accounts/components/VerifyMasterPasswordForm.tsx
@@ -147,17 +147,20 @@ export const VerifyMasterPasswordForm: React.FC<
throw Error("couldn't get key attributes");
}
+ let key: string;
try {
- const key = await cryptoWorker.decryptB64(
+ key = await cryptoWorker.decryptB64(
keyAttributes.encryptedKey,
keyAttributes.keyDecryptionNonce,
kek,
);
- onVerify(key, kek, keyAttributes, passphrase);
} catch (e) {
- log.error("user entered a wrong password", e);
- throw Error(CustomError.INCORRECT_PASSWORD);
+ log.warn("Incorrect password", e);
+ setFieldError(t("incorrect_password"));
+ return;
}
+
+ onVerify(key, kek, keyAttributes, passphrase);
} catch (e) {
if (e instanceof Error) {
if (e.message === CustomError.TWO_FACTOR_ENABLED) {
@@ -166,9 +169,6 @@ export const VerifyMasterPasswordForm: React.FC<
}
log.error("failed to verify passphrase", e);
switch (e.message) {
- case CustomError.INCORRECT_PASSWORD:
- setFieldError(t("incorrect_password"));
- break;
case CustomError.INCORRECT_PASSWORD_OR_NO_ACCOUNT:
setFieldError(t("incorrect_password_or_no_account"));
break;
diff --git a/web/packages/shared/error/index.ts b/web/packages/shared/error/index.ts
index 3aa47fa01c..dd6d7d961c 100644
--- a/web/packages/shared/error/index.ts
+++ b/web/packages/shared/error/index.ts
@@ -40,7 +40,6 @@ export const CustomError = {
BAD_REQUEST: "bad request",
SUBSCRIPTION_NEEDED: "subscription not present",
NOT_FOUND: "not found ",
- INCORRECT_PASSWORD: "incorrect password",
INCORRECT_PASSWORD_OR_NO_ACCOUNT: "incorrect password or no such account",
UPLOAD_CANCELLED: "upload cancelled",
UPDATE_EXPORTED_RECORD_FAILED: "update file exported record failed",