Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
c19c893
refactor(account): make hosts the single source of auth copy
MaanilVerma Sep 14, 2026
e211cd3
fix(locales): drop account-existence wording from email-already-in-use
MaanilVerma Sep 14, 2026
64ece9e
test(auth): guard cloud auth copy against account enumeration
MaanilVerma Sep 14, 2026
3aa6c3c
test(auth): address review nits on auth copy resolution
MaanilVerma Sep 14, 2026
36c5790
test(website): assert the collapsed invalid-credential line on user-n…
MaanilVerma Sep 15, 2026
c66a653
fix(website): drop the unrenderable user-not-found/wrong-password copy
MaanilVerma Sep 15, 2026
9348238
test(website): broaden the sign-in enumeration oracle to match the cl…
MaanilVerma Sep 15, 2026
b742c75
Merge branch 'main' into maanil/fe-2188-localization-sso
MaanilVerma Sep 15, 2026
7184764
fix(locales): drop the unrenderable user-not-found/wrong-password copy
MaanilVerma Sep 15, 2026
d0e3c13
Merge branch 'main' into maanil/fe-2188-localization-sso
MaanilVerma Sep 15, 2026
3633eb7
test(website): use the i18n generic-error copy after the main merge
MaanilVerma Sep 15, 2026
cea548a
Merge branch 'main' into maanil/fe-2188-localization-sso
MaanilVerma Sep 15, 2026
61b4451
fix(workspace): type the session error key against the locale shape
MaanilVerma Sep 15, 2026
b7a3541
Merge branch 'main' into maanil/fe-2188-localization-sso
MaanilVerma Sep 15, 2026
885faf4
Merge branch 'main' into maanil/fe-2188-localization-sso
MaanilVerma Sep 15, 2026
e68e3f0
Merge remote-tracking branch 'origin/main' into maanil/fe-2188-locali…
MaanilVerma Sep 15, 2026
9874cfe
Merge branch 'main' into maanil/fe-2188-localization-sso
MaanilVerma Sep 16, 2026
23c5bb6
test(auth): share the enumeration oracle and cover the cancelled seco…
MaanilVerma Sep 16, 2026
df8ea1d
Merge branch 'main' into maanil/fe-2188-localization-sso
MaanilVerma Sep 16, 2026
448c4b9
Merge remote-tracking branch 'origin/main' into maanil/fe-2188-locali…
MaanilVerma Sep 17, 2026
386d96d
Merge remote-tracking branch 'origin/main' into maanil/fe-2188-locali…
MaanilVerma Sep 17, 2026
9826d1b
Merge remote-tracking branch 'origin/main' into maanil/fe-2188-locali…
MaanilVerma Sep 17, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion apps/billing-web/src/auth/useSignInController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand All @@ -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<SignInState>({ step: 'idle' })
Expand All @@ -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)
: ''
)

Expand Down
16 changes: 16 additions & 0 deletions apps/billing-web/src/locales/en/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
5 changes: 2 additions & 3 deletions apps/website/e2e/auth-live-errors.spec.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -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\//)
})
Expand Down
11 changes: 4 additions & 7 deletions apps/website/src/components/auth/AuthEmailForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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"
/>
<small
Expand All @@ -268,7 +265,7 @@ defineExpose({ resetTurnstile })
aria-live="polite"
class="opacity-80"
>
{{ TURNSTILE_MESSAGES[locale].submitBlockedHint }}
{{ t('auth.turnstile.submitBlockedHint', locale) }}
</small>

<button
Expand Down
18 changes: 18 additions & 0 deletions apps/website/src/components/auth/AuthForgotPassword.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ describe('AuthForgotPassword', () => {
await waitFor(() =>
expect(toasts.value[0]).toMatchObject({
severity: 'error',
summary: 'Error',
detail: expect.stringContaining(detail)
})
)
Expand All @@ -149,6 +150,23 @@ describe('AuthForgotPassword', () => {
}
)

it('surfaces a dismissed-popup failure as a warning, not an error', async () => {
h.sendReset.mockRejectedValue({
code: 'auth/popup-closed-by-user',
message: 'x'
})
render(AuthForgotPassword)
await typeEmail('user@example.com')
await clickSend()

await waitFor(() =>
expect(toasts.value[0]).toMatchObject({
severity: 'warn',
summary: 'Warning'
})
)
})

it('rejects a malformed address before asking Firebase', async () => {
render(AuthForgotPassword)
await typeEmail('not-an-email')
Expand Down
3 changes: 1 addition & 2 deletions apps/website/src/components/auth/AuthForgotPassword.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<script setup lang="ts">
import {
AUTH_TOAST_SUMMARIES,
classifyAuthError,
isFirebaseAuthErrorLike,
severityForAuthError
Expand Down Expand Up @@ -157,7 +156,7 @@ function reportSendFailure(error: unknown) {
const severity = severityForAuthError(classification)
addToast({
severity,
summary: AUTH_TOAST_SUMMARIES[locale][severity],
summary: t(severity === 'warn' ? 'g.warning' : 'g.error', locale),
Comment thread
MaanilVerma marked this conversation as resolved.
Resolved
detail: signInErrorMessage(classification, locale, hostname)
})
}
Expand Down
12 changes: 6 additions & 6 deletions apps/website/src/components/auth/AuthSignIn.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ import { render, screen, waitFor } from '@testing-library/vue'
import userEvent from '@testing-library/user-event'
import { beforeEach, describe, expect, it, vi } from 'vitest'

import { AUTH_ERROR_MESSAGES } from '@comfyorg/account-core/firebaseAuthError'
import type {
TurnstileApi,
TurnstileRenderOptions
} from '@comfyorg/account-core/turnstileScript'

import { removeAllToasts, useAuthToasts } from '../../config/auth-toast-state'
import { t } from '../../i18n/translations'
import AuthSignIn from './AuthSignIn.vue'
import AuthToast from './AuthToast.vue'

Expand Down Expand Up @@ -337,7 +337,7 @@ describe('AuthSignIn', () => {
expect(alert.getAttribute('data-severity')).toBe('warn')
expect(alert.textContent).toContain('Warning')
expect(alert.textContent).toContain(
AUTH_ERROR_MESSAGES['auth/popup-closed-by-user']
t('auth.errors.auth/popup-closed-by-user', 'en')
)
expect(toasts.value).toHaveLength(1)
expect(
Expand Down Expand Up @@ -855,8 +855,8 @@ describe('AuthSignIn', () => {
expect(alert.getAttribute('data-severity')).toBe('error')
expect(
alert.textContent,
'the cloud app names the code; the website reads the same line'
).toContain(AUTH_ERROR_MESSAGES['auth/user-not-found'])
'user-not-found collapses to the neutral invalid-credential line so the toast never confirms whether the email has an account'
).toContain(t('auth.errors.auth/invalid-credential', 'en'))
expect(toasts.value[0].life).toBeUndefined()
expect(replace).not.toHaveBeenCalled()
})
Expand Down Expand Up @@ -1077,7 +1077,7 @@ describe('AuthSignIn', () => {
await userEvent.setup().click(button)

await waitFor(() => expect(fresh.value).toHaveLength(1))
expect(fresh.value[0].detail).toBe(AUTH_ERROR_MESSAGES.generic)
expect(fresh.value[0].detail).toBe(t('auth.errors.generic', 'en'))
expect(
button.disabled,
'a failed chunk load must not strand the page in pending'
Expand Down Expand Up @@ -1474,7 +1474,7 @@ describe('AuthSignIn controller lifecycle', () => {
toasts.value,
'a hung email request recovers with a message rather than silently re-enabling'
).toHaveLength(1)
expect(toasts.value[0].detail).toBe(AUTH_ERROR_MESSAGES.generic)
expect(toasts.value[0].detail).toBe(t('auth.errors.generic', 'en'))
expect(
screen.getByRole('button', { name: /^sign in$/i }),
'a bounded email request frees the controls at its deadline'
Expand Down
4 changes: 2 additions & 2 deletions apps/website/src/components/auth/useAuthSignInController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* state and calls the returned commands; it holds no flow logic of its own.
*/
import {
AUTH_TOAST_SUMMARIES,
isFirebaseAuthErrorLike,
severityForAuthError
} from '@comfyorg/account-core/firebaseAuthError'
Expand Down Expand Up @@ -37,6 +36,7 @@ import {
import type { WorkshopSessionUser } from '../../config/workshop-session-state'
import { useWorkshopSession } from '../../config/workshop-session-state'
import type { Locale } from '../../i18n/translations'
import { t } from '../../i18n/translations'
import {
captureAuthCompleted,
captureAuthFailed,
Expand Down Expand Up @@ -212,7 +212,7 @@ export function useAuthSignInController(options: AuthSignInControllerOptions) {
const severity = severityForAuthError(classification)
addToast({
severity,
summary: AUTH_TOAST_SUMMARIES[locale][severity],
summary: t(severity === 'warn' ? 'g.warning' : 'g.error', locale),
detail: signInErrorMessage(classification, locale, hostname)
})
}
Expand Down
95 changes: 71 additions & 24 deletions apps/website/src/config/auth-sign-in-state.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import { ENUMERATION_ORACLE } from '@comfyorg/account-core/testing'
import { describe, expect, it } from 'vitest'

import {
AUTH_ERROR_COPY,
AUTH_ERROR_MESSAGES
} from '@comfyorg/account-core/firebaseAuthError'

import { t } from '../i18n/translations'
import type { AuthSignInState } from './auth-sign-in-state'
import { authSignInTransition, signInErrorMessage } from './auth-sign-in-state'

Expand Down Expand Up @@ -149,65 +146,115 @@ describe('signInErrorMessage', () => {
[
'a dismissed popup',
{ code: 'auth/popup-closed-by-user', message: 'x' },
AUTH_ERROR_MESSAGES['auth/popup-closed-by-user']
t('auth.errors.auth/popup-closed-by-user', 'en')
Comment thread
MaanilVerma marked this conversation as resolved.
Resolved
],
[
'a cancelled second popup',
{ code: 'auth/cancelled-popup-request', message: 'x' },
t('auth.errors.auth/cancelled-popup-request', 'en')
],
[
'a blocked signup',
{ code: 'auth/internal-error', message: 'SIGNUP_BLOCKED' },
AUTH_ERROR_MESSAGES.signupBlocked
t('auth.errors.signupBlocked', 'en')
],
[
'wrong email credentials',
{ code: 'auth/invalid-credential', message: 'x' },
AUTH_ERROR_MESSAGES['auth/invalid-credential']
t('auth.errors.auth/invalid-credential', 'en')
],
[
'an address already registered',
{ code: 'auth/email-already-in-use', message: 'x' },
AUTH_ERROR_MESSAGES['auth/email-already-in-use']
t('auth.errors.auth/email-already-in-use', 'en')
],
[
'a throttled visitor',
{ code: 'auth/too-many-requests', message: 'x' },
AUTH_ERROR_MESSAGES['auth/too-many-requests']
t('auth.errors.auth/too-many-requests', 'en')
],
[
'an unknown address, worded as the cloud app words it',
'an unknown address, collapsed to the neutral invalid-credential line',
{ code: 'auth/user-not-found', message: 'x' },
AUTH_ERROR_MESSAGES['auth/user-not-found']
t('auth.errors.auth/invalid-credential', 'en')
],
[
'a wrong password',
'a wrong password, collapsed to the neutral invalid-credential line',
{ code: 'auth/wrong-password', message: 'x' },
AUTH_ERROR_MESSAGES['auth/wrong-password']
t('auth.errors.auth/invalid-credential', 'en')
],
[
'a malformed address',
{ code: 'auth/invalid-email', message: 'x' },
AUTH_ERROR_MESSAGES['auth/invalid-email']
t('auth.errors.auth/invalid-email', 'en')
],
[
'a network failure, which the cloud app names',
'a network failure',
{ code: 'auth/network-request-failed', message: 'x' },
AUTH_ERROR_MESSAGES['auth/network-request-failed']
t('auth.errors.auth/network-request-failed', 'en')
],
[
'an unknown auth code',
{ code: 'auth/some-new-code', message: 'x' },
AUTH_ERROR_MESSAGES.generic
t('auth.errors.generic', 'en')
],
[
'a non-Firebase failure',
new Error('customers 500'),
AUTH_ERROR_MESSAGES.generic
t('auth.errors.generic', 'en')
],
[
'a non-auth Firebase failure, which the cloud app also reads as generic',
'a non-auth Firebase failure, read as generic',
{ code: 'app/no-app', message: 'x' },
AUTH_ERROR_MESSAGES.generic
t('auth.errors.generic', 'en')
]
] as const)('resolves %s from this host i18n', ([, error, copy]) => {
expect(
signInErrorMessage(failed(error), 'en', 'comfy.org'),
'the account package ships the resolution rules; this host owns the copy'
).toBe(copy)
})

it.for([
[
'auth/email-already-in-use',
'sign-up rejects an already-registered email'
],
[
'auth/account-exists-with-different-credential',
'a provider collision only happens for an already-registered email'
]
] as const)("speaks the cloud app's line for %s", ([, error, copy]) => {
expect(signInErrorMessage(failed(error), 'en', 'comfy.org')).toBe(copy)
] as const)(
'gives %s recovery guidance that never confirms the account exists',
([code, why]) => {
const message = signInErrorMessage(
failed({ code, message: 'x' }),
'en',
'comfy.org'
)
expect(
message,
`${why}; copy that confirms the account exists is an enumeration oracle`
).not.toMatch(ENUMERATION_ORACLE)
expect(
message,
`${why}; the neutral copy must still offer a password reset`
).toMatch(/reset(?:ting)? your password/i)
}
)

it('catches account-existence synonyms the shipped neutral copy avoids', () => {
// A re-worded leak like "This email is already registered" carries neither
// "exists" nor "different sign-in method", so the first-draft oracle waved
// it through; the broadened oracle rejects it while the shipped line passes.
expect('This email is already registered').toMatch(ENUMERATION_ORACLE)
expect(
signInErrorMessage(
failed({ code: 'auth/email-already-in-use', message: 'x' }),
'en',
'comfy.org'
)
).not.toMatch(ENUMERATION_ORACLE)
})

it('names this host in the unauthorized-domain line', () => {
Expand All @@ -229,6 +276,6 @@ describe('signInErrorMessage', () => {
'ja',
'comfy.org'
)
).toBe(AUTH_ERROR_COPY.ja['auth/popup-blocked'])
).toBe(t('auth.errors.auth/popup-blocked', 'ja'))
})
})
Loading
Loading