Skip to content

armgit / ente

Public Imported from GitHub
0

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

scope

Manav Rathi691469ef5e0d
diff --git a/web/packages/accounts/services/srp-remote.ts b/web/packages/accounts/services/srp-remote.ts
index 85823f8b3f..79b86163e3 100644
--- a/web/packages/accounts/services/srp-remote.ts
+++ b/web/packages/accounts/services/srp-remote.ts
@@ -156,7 +156,9 @@ export const verifySRPSession = async (
// eslint-disable-next-line @typescript-eslint/no-unsafe-enum-comparison
e.httpStatusCode === HttpStatusCode.Unauthorized
) {
- throw Error(CustomError.INCORRECT_PASSWORD);
+ // The API contract allows for a SRP verification 401 both because
+ // of incorrect credentials or a non existent account.
+ throw Error(CustomError.INCORRECT_PASSWORD_OR_NO_ACCOUNT);
} else {
throw e;
}
diff --git a/web/packages/shared/components/VerifyMasterPasswordForm.tsx b/web/packages/shared/components/VerifyMasterPasswordForm.tsx
index 9ce105d720..5ade7afd46 100644
--- a/web/packages/shared/components/VerifyMasterPasswordForm.tsx
+++ b/web/packages/shared/components/VerifyMasterPasswordForm.tsx
@@ -31,8 +31,9 @@ export interface VerifyMasterPasswordFormProps {
* the form that some other form of second factor is enabled and the user
* has been redirected to a two factor verification page.
*
- * This function can throw an `CustomError.INCORRECT_PASSWORD` to signal
- * that either that the password is incorrect, or no such account exists.
+ * This function can throw an `CustomError.INCORRECT_PASSWORD_OR_NO_ACCOUNT`
+ * to signal that either that the password is incorrect, or no account with
+ * the provided email exists.
*/
getKeyAttributes?: (kek: string) => Promise<KeyAttributes | undefined>;
srpAttributes?: SRPAttributes;
@@ -105,16 +106,10 @@ export default function VerifyMasterPasswordForm({
setFieldError(t("weak_device_hint"));
break;
case CustomError.INCORRECT_PASSWORD:
- if (getKeyAttributes) {
- // During login flow, the API contract allows for a
- // SRP verification 401 both because of incorrect
- // credentials or a non existent account.
- setFieldError(t("incorrect_password_or_no_account"));
- } else {
- // During in-app reauthentication, the reason is
- // unambiguous.
- setFieldError(t("incorrect_password"));
- }
+ setFieldError(t("incorrect_password"));
+ break;
+ case CustomError.INCORRECT_PASSWORD_OR_NO_ACCOUNT:
+ setFieldError(t("incorrect_password_or_no_account"));
break;
default:
setFieldError(t("generic_error"));
diff --git a/web/packages/shared/error/index.ts b/web/packages/shared/error/index.ts
index 206e73dfd9..ca120ad44c 100644
--- a/web/packages/shared/error/index.ts
+++ b/web/packages/shared/error/index.ts
@@ -36,6 +36,7 @@ export const CustomError = {
NOT_FOUND: "not found ",
WEAK_DEVICE: "password decryption failed on the device",
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",
EXPORT_STOPPED: "export stopped",