diff --git a/apps/web/pages/auth/login.tsx b/apps/web/pages/auth/login.tsx index 575b4ce213..fecb9d6856 100644 --- a/apps/web/pages/auth/login.tsx +++ b/apps/web/pages/auth/login.tsx @@ -69,7 +69,7 @@ export default function Login({ const errorMessages: { [key: string]: string } = { // [ErrorCode.SecondFactorRequired]: t("2fa_enabled_instructions"), // Don't leak information about whether an email is registered or not - [ErrorCode.IncorrectUsernamePassword]: t("incorrect_username_password"), + [ErrorCode.IncorrectEmailPassword]: t("incorrect_email_password"), [ErrorCode.IncorrectTwoFactorCode]: `${t("incorrect_2fa_code")} ${t("please_try_again")}`, [ErrorCode.InternalServerError]: `${t("something_went_wrong")} ${t("please_try_again_and_contact_us")}`, [ErrorCode.ThirdPartyIdentityProviderEnabled]: t("account_created_with_identity_provider"), diff --git a/apps/web/playwright/login.e2e.ts b/apps/web/playwright/login.e2e.ts index b914a2cc4a..13f0cdd049 100644 --- a/apps/web/playwright/login.e2e.ts +++ b/apps/web/playwright/login.e2e.ts @@ -58,7 +58,7 @@ test.describe("Login and logout tests", () => { test.describe("Login flow validations", async () => { test("Should warn when user does not exist", async ({ page }) => { - const alertMessage = (await localize("en"))("incorrect_username_password"); + const alertMessage = (await localize("en"))("incorrect_email_password"); // Login with a non-existent user const never = "never"; @@ -69,7 +69,7 @@ test.describe("Login and logout tests", () => { }); test("Should warn when password is incorrect", async ({ page, users }) => { - const alertMessage = (await localize("en"))("incorrect_username_password"); + const alertMessage = (await localize("en"))("incorrect_email_password"); // by default password===username with the users fixture const pro = await users.create({ username: "pro" }); diff --git a/apps/web/public/static/locales/en/common.json b/apps/web/public/static/locales/en/common.json index 86338a8b08..dfdbe15ce4 100644 --- a/apps/web/public/static/locales/en/common.json +++ b/apps/web/public/static/locales/en/common.json @@ -477,7 +477,7 @@ "max_limit_allowed_hint": "Must be {{limit}} or fewer characters long", "invalid_password_hint": "The password must be a minimum of {{passwordLength}} characters long containing at least one number and have a mixture of uppercase and lowercase letters", "incorrect_password": "Password is incorrect.", - "incorrect_username_password": "Username or password is incorrect.", + "incorrect_email_password": "Email or password is incorrect.", "use_setting": "Use setting", "am_pm": "am/pm", "time_options": "Time options", diff --git a/packages/features/auth/lib/ErrorCode.ts b/packages/features/auth/lib/ErrorCode.ts index 2c6ea243fe..d052349164 100644 --- a/packages/features/auth/lib/ErrorCode.ts +++ b/packages/features/auth/lib/ErrorCode.ts @@ -1,5 +1,5 @@ export enum ErrorCode { - IncorrectUsernamePassword = "incorrect-username-password", + IncorrectEmailPassword = "incorrect-email-password", UserNotFound = "user-not-found", IncorrectPassword = "incorrect-password", UserMissingPassword = "missing-password", diff --git a/packages/features/auth/lib/next-auth-options.ts b/packages/features/auth/lib/next-auth-options.ts index 9d06eb62e5..00b6ac5333 100644 --- a/packages/features/auth/lib/next-auth-options.ts +++ b/packages/features/auth/lib/next-auth-options.ts @@ -100,7 +100,7 @@ const providers: Provider[] = [ // Don't leak information about it being username or password that is invalid if (!user) { - throw new Error(ErrorCode.IncorrectUsernamePassword); + throw new Error(ErrorCode.IncorrectEmailPassword); } await checkRateLimitAndThrowError({ @@ -112,16 +112,16 @@ const providers: Provider[] = [ } if (!user.password && user.identityProvider !== IdentityProvider.CAL && !credentials.totpCode) { - throw new Error(ErrorCode.IncorrectUsernamePassword); + throw new Error(ErrorCode.IncorrectEmailPassword); } if (user.password || !credentials.totpCode) { if (!user.password) { - throw new Error(ErrorCode.IncorrectUsernamePassword); + throw new Error(ErrorCode.IncorrectEmailPassword); } const isCorrectPassword = await verifyPassword(credentials.password, user.password); if (!isCorrectPassword) { - throw new Error(ErrorCode.IncorrectUsernamePassword); + throw new Error(ErrorCode.IncorrectEmailPassword); } }