diff --git a/apps/billing-web/src/auth/useSignInController.ts b/apps/billing-web/src/auth/useSignInController.ts index 3a21d0154ef..4fe787846eb 100644 --- a/apps/billing-web/src/auth/useSignInController.ts +++ b/apps/billing-web/src/auth/useSignInController.ts @@ -5,6 +5,7 @@ */ import type { FirebaseIdentity } from '@comfyorg/account-core/firebase' import { authErrorMessage } from '@comfyorg/account-core/firebaseAuthError' +import type { AuthErrorCopy } from '@comfyorg/account-core/firebaseAuthError' import type { User, UserCredential } from 'firebase/auth' import { computed, ref, watch } from 'vue' @@ -14,12 +15,15 @@ import type { SignInState } from '@/auth/signInState' import { signInTransition } from '@/auth/signInState' +import en from '@/locales/en/main.json' with { type: 'json' } import { billingWebIdentity } from '@/config/firebase' import { billingWebSessionClient, useBillingWebSession } from '@/session/billingWebSession' +const AUTH_ERROR_COPY: AuthErrorCopy = en.auth.errors + export function useSignInController(onSignedIn: () => void) { const { user } = useBillingWebSession() const state = ref({ step: 'idle' }) @@ -40,7 +44,7 @@ export function useSignInController(onSignedIn: () => void) { }) const errorMessage = computed(() => state.value.step === 'error' - ? authErrorMessage(state.value.classification, 'en') + ? authErrorMessage(state.value.classification, AUTH_ERROR_COPY) : '' ) diff --git a/apps/billing-web/src/locales/en/main.json b/apps/billing-web/src/locales/en/main.json index 284a0d6f923..f927fe78044 100644 --- a/apps/billing-web/src/locales/en/main.json +++ b/apps/billing-web/src/locales/en/main.json @@ -25,6 +25,22 @@ "placeholder": "Enter your password", "show": "Show password", "hide": "Hide password" + }, + "errors": { + "auth/invalid-email": "Please enter a valid email address.", + "auth/user-disabled": "This account has been disabled. Please contact support.", + "auth/email-already-in-use": "We couldn't create an account with this email. Try signing in or resetting your password instead.", + "auth/weak-password": "Password is too weak. Please use a stronger password with at least 6 characters.", + "auth/too-many-requests": "Too many login attempts. Please wait a moment and try again.", + "auth/operation-not-allowed": "This sign-in method is not currently supported.", + "auth/invalid-credential": "Invalid login credentials. Please check your email and password.", + "auth/network-request-failed": "Network error. Please check your connection and try again.", + "auth/popup-closed-by-user": "The sign-in window closed before sign-in finished. Please try again.", + "auth/cancelled-popup-request": "Another sign-in window was already open, so this one was cancelled. Please try again.", + "auth/popup-blocked": "Your browser blocked the sign-in window. Please allow pop-ups for this site and try again.", + "auth/account-exists-with-different-credential": "We couldn't sign you in with this method. Try another sign-in option, or reset your password to continue.", + "generic": "Something went wrong while signing you in. Please try again.", + "signupBlocked": "We couldn't create your account right now. Please try again later. If this keeps happening, email support@comfy.org." } }, "validation": { diff --git a/apps/website/e2e/auth-live-errors.spec.ts b/apps/website/e2e/auth-live-errors.spec.ts index dc1052aef17..c7cfc781d67 100644 --- a/apps/website/e2e/auth-live-errors.spec.ts +++ b/apps/website/e2e/auth-live-errors.spec.ts @@ -1,6 +1,7 @@ import { expect } from '@playwright/test' import type { Page, Route } from '@playwright/test' +import { t } from '../src/i18n/translations' import { test } from './fixtures/blockExternalMedia' import { WORKSHOP_EMAIL, @@ -147,9 +148,7 @@ test.describe('Live sign-up error codes and password checklist', () => { await page.getByRole('button', { name: 'Sign up', exact: true }).click() await expect( - page.getByText( - 'An account with this email already exists. Try signing in instead.' - ) + page.getByText(t('auth.errors.auth/email-already-in-use', 'en')) ).toBeVisible() await expect(page).toHaveURL(/\/signup\//) }) diff --git a/apps/website/src/components/auth/AuthEmailForm.vue b/apps/website/src/components/auth/AuthEmailForm.vue index eb34b96232d..4e3f25fb01b 100644 --- a/apps/website/src/components/auth/AuthEmailForm.vue +++ b/apps/website/src/components/auth/AuthEmailForm.vue @@ -2,10 +2,7 @@ import { cn } from '@comfyorg/tailwind-utils' import { computed, ref, useTemplateRef } from 'vue' -import { - TURNSTILE_MESSAGES, - isTurnstileEnabled -} from '@comfyorg/account-core/turnstile' +import { isTurnstileEnabled } from '@comfyorg/account-core/turnstile' import PasswordRules from '@comfyorg/account-ui/auth/PasswordRules' import TurnstileWidget from '@comfyorg/account-ui/auth/TurnstileWidget' import { useTurnstileGate } from '@comfyorg/account-ui/auth/turnstileGate' @@ -257,8 +254,8 @@ defineExpose({ resetTurnstile }) v-model:unavailable="unavailable" :site-key="WORKSHOP_TURNSTILE_SITE_KEY" theme="dark" - :expired-message="TURNSTILE_MESSAGES[locale].expired" - :failed-message="TURNSTILE_MESSAGES[locale].failed" + :expired-message="t('auth.turnstile.expired', locale)" + :failed-message="t('auth.turnstile.failed', locale)" error-class="text-red-500" /> - {{ TURNSTILE_MESSAGES[locale].submitBlockedHint }} + {{ t('auth.turnstile.submitBlockedHint', locale) }}