From ff077bfbe78698252beeb72f15a36aced8f1d011 Mon Sep 17 00:00:00 2001 From: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com> Date: Wed, 23 Sep 2026 17:12:34 +0800 Subject: [PATCH] fix(auth): hide unavailable method catalog warning Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com> --- web/src/i18n/locales/en.json | 1 - web/src/i18n/locales/ru.json | 1 - web/src/i18n/locales/zh.json | 1 - web/src/pages/login.test.tsx | 11 +++++++++++ web/src/pages/login.tsx | 6 +----- 5 files changed, 12 insertions(+), 8 deletions(-) diff --git a/web/src/i18n/locales/en.json b/web/src/i18n/locales/en.json index 4f782ca6..31f1da06 100644 --- a/web/src/i18n/locales/en.json +++ b/web/src/i18n/locales/en.json @@ -348,7 +348,6 @@ "organizationContinue": "Find sign-in methods", "organizationSearching": "Searching...", "organizationNotFound": "No organization sign-in method is available. Check your details or contact your administrator.", - "methodsUnavailable": "Sign-in methods are temporarily unavailable. Please try again.", "externalIdentityMethods": "External identity sources", "externalIdentityHint": "Feishu, DingTalk, GitHub, GitLab, and similar entries are advertised by the server. Account ownership is decided by backend binding and organization membership.", "tabPassword": "Password", diff --git a/web/src/i18n/locales/ru.json b/web/src/i18n/locales/ru.json index 279b5eb6..1312725e 100644 --- a/web/src/i18n/locales/ru.json +++ b/web/src/i18n/locales/ru.json @@ -348,7 +348,6 @@ "organizationContinue": "Найти способы входа", "organizationSearching": "Поиск...", "organizationNotFound": "Способ входа для организации не найден. Проверьте данные или обратитесь к администратору.", - "methodsUnavailable": "Способы входа временно недоступны. Повторите попытку позже.", "externalIdentityMethods": "Внешние источники идентификации", "externalIdentityHint": "Feishu, DingTalk, GitHub, GitLab и похожие входы публикуются сервером. Принадлежность аккаунта определяют привязки и членство в организациях на backend.", "tabPassword": "Пароль", diff --git a/web/src/i18n/locales/zh.json b/web/src/i18n/locales/zh.json index e9b9705a..c49185b4 100644 --- a/web/src/i18n/locales/zh.json +++ b/web/src/i18n/locales/zh.json @@ -348,7 +348,6 @@ "organizationContinue": "查找登录方式", "organizationSearching": "查找中...", "organizationNotFound": "未找到可用的组织登录方式。请核对信息,或联系组织管理员。", - "methodsUnavailable": "暂时无法获取登录方式,请稍后重试。", "externalIdentityMethods": "外部身份源", "externalIdentityHint": "飞书、钉钉、GitHub、GitLab 等入口由服务端配置;登录后的账号归属由后端绑定和组织关系决定。", "tabPassword": "账号密码", diff --git a/web/src/pages/login.test.tsx b/web/src/pages/login.test.tsx index f80a698b..7d26202c 100644 --- a/web/src/pages/login.test.tsx +++ b/web/src/pages/login.test.tsx @@ -125,9 +125,20 @@ describe('LoginPage', () => { render() expect(screen.queryByRole('button', { name: 'login.tabEnterprise' })).toBeNull() + expect(screen.queryByRole('alert')).toBeNull() expect(screen.getByLabelText('login.password').closest('[hidden]')).toBeNull() }) + it('keeps password login available without a warning when the method catalog fails', () => { + authMethodsFixture.methods = [] + authMethodsFixture.isError = true + render() + + expect(screen.queryByRole('alert')).toBeNull() + expect(screen.queryByRole('button', { name: 'login.tabEnterprise' })).toBeNull() + expect(screen.getByRole('button', { name: 'login.submit' })).toBeTruthy() + }) + it('hides an unusable session bootstrap entry when the web runtime is not configured', () => { authMethodsFixture.methods = [{ id: 'proxy', methodType: 'SESSION_BOOTSTRAP' }] render() diff --git a/web/src/pages/login.tsx b/web/src/pages/login.tsx index 9d7046e2..9e9307a6 100644 --- a/web/src/pages/login.tsx +++ b/web/src/pages/login.tsx @@ -31,7 +31,7 @@ export function LoginPage() { const [loginMode, setLoginMode] = useState<'personal' | 'organization'>('personal') const [fieldErrors, setFieldErrors] = useState<{ username?: string, password?: string }>({}) const isChinese = i18n.resolvedLanguage?.split('-')[0] === 'zh' - const { data: authMethods, isLoading: authMethodsLoading, isError: authMethodsError } = useAuthMethods(search.returnTo) + const { data: authMethods, isLoading: authMethodsLoading } = useAuthMethods(search.returnTo) const returnTo = search.returnTo && search.returnTo.startsWith('/') ? search.returnTo : '/dashboard' const disabledMessage = search.reason === 'accountDisabled' ? t('apiError.auth.accountDisabled') : null @@ -194,10 +194,6 @@ export function LoginPage() { ) : null} - {authMethodsError ? ( -

{t('login.methodsUnavailable')}

- ) : null} - {authMethodsLoading || hasExternalMethods ? (