π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
[web] Tweak error message
Manav Rathi8106bc69402c
diff --git a/web/packages/base/locales/en-US/translation.json b/web/packages/base/locales/en-US/translation.jsonindex 9f75e19217..d27e7437bc 100644--- a/web/packages/base/locales/en-US/translation.json+++ b/web/packages/base/locales/en-US/translation.json@@ -32,6 +32,7 @@"set_password": "Set password","sign_in": "Sign in","incorrect_password": "Incorrect password",+ "incorrect_password_or_no_account": "Incorrect password or email not registered","pick_password_hint": "Please enter a password that we can use to encrypt your data","pick_password_caution": "We don't store your password, so if you forget it, <strong>we will not be able to help you </strong>recover your data without a recovery key.","key_generation_in_progress": "Generating encryption keys...",diff --git a/web/packages/shared/components/VerifyMasterPasswordForm.tsx b/web/packages/shared/components/VerifyMasterPasswordForm.tsxindex 618801101d..9ce105d720 100644--- a/web/packages/shared/components/VerifyMasterPasswordForm.tsx+++ b/web/packages/shared/components/VerifyMasterPasswordForm.tsx@@ -11,7 +11,6 @@ import type { KeyAttributes, User } from "../user/types";export interface VerifyMasterPasswordFormProps {user: User | undefined;- keyAttributes: KeyAttributes | undefined;callback: (key: string,kek: string,@@ -19,16 +18,25 @@ export interface VerifyMasterPasswordFormProps {passphrase?: string,) => void;buttonText: string;- submitButtonProps?: ButtonProps;+ keyAttributes: KeyAttributes | undefined;/*** A callback invoked when the form wants to get {@link KeyAttributes}.*+ * It is only provided during the login flow, where we do not have+ * {@link keyAttributes} already available for the user. In case the form is+ * used for reauthenticating the user after they've already logged in, then+ * this function will not be provided.+ ** This function can throw an `CustomError.TWO_FACTOR_ENABLED` to signal to* 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.*/getKeyAttributes?: (kek: string) => Promise<KeyAttributes | undefined>;srpAttributes?: SRPAttributes;+ submitButtonProps?: ButtonProps;}export default function VerifyMasterPasswordForm({@@ -97,7 +105,16 @@ export default function VerifyMasterPasswordForm({setFieldError(t("weak_device_hint"));break;case CustomError.INCORRECT_PASSWORD:- setFieldError(t("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"));+ }break;default:setFieldError(t("generic_error"));