Repository navigation
feat(web): 未配置发件的 2FA/忘记密码/设置页提示态 (ONE-461) - #154
Merged
Merged
Conversation
- 新增 useEmailConfigured:读 GET /api/system/info 的 email_configured, 查询失败或字段缺失按 false(fail-closed),与 §3.1 同一口径 - 忘记密码页:未配置时整页提示态(保留 AuthShell 与标题,仅说明文案 + 返回登录),已配置逐字不变;保留竞态兜底,提交时收到 503 EMAIL_NOT_CONFIGURED 切到同一提示态 - 登录页:403 code=2FA_METHOD_UNAVAILABLE 映射为本地化文案后走既有 FormError,其余错误仍透传后端 message(api 层未吞 code/message) - 设置页邮件 OTP 一节:未配置且未启用 → 不渲染启用按钮,改 muted 说明; 未配置但已启用 → 保留徽标与禁用按钮 + 现成 AlertTriangle 警告行; 已配置逐字不变 - 新增文案全部进 zh.json / en.json 双语键,无硬编码字符串
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ONE-461 前端:未配置发件服务的 2FA / 忘记密码 / 设置页提示态
父单 ONE-461,子单 ONE-467(前端实现环节)。规格 §3.7–§3.10。档位:复杂 + 高安全档(全流程)。
基线 main
ebf20f7。只改web/,不碰worker/。改动
web/src/pages/auth/LoginPage.tsxcode === "2FA_METHOD_UNAVAILABLE"→ 本地化文案后进既有FormError;其余错误仍透传后端message。web/src/lib/api.ts的ApiError本来就同时保留message与code,故无需改 api 层web/src/pages/auth/ForgotPasswordPage.tsxemail_configured:未配置(含查询失败)→ 整页提示态(保留AuthShell+「忘记密码」标题,主体仅说明文案 +「返回登录」),不渲染邮箱输入框与发送按钮;提交时收到 503EMAIL_NOT_CONFIGURED→ 切同一提示态(竞态兜底);已配置时页面与交互逐字不变web/src/pages/settings/SettingsPage.tsxAlertTriangle+ muted 样式);已配置逐字不变web/src/locales/{zh,en}.jsonauth.twoFactorUnavailable、auth.forgotPasswordUnavailable、settings.emailOtpUnavailable、settings.emailOtpUnavailableWarningweb/src/hooks/useEmailConfigured.ts(新)GET /api/system/info的email_configured;查询失败 / 字段缺失一律false(fail-closed,与 §3.1 同一口径),供忘记密码页与设置页复用不新建页面、不新增路由、不新造视觉组件(提示态/警示行复用
AuthShell/FormError/ muted 文本 / 既有AlertTriangle行)。无硬编码文案。依赖与联调说明(重要)
/api/system/info.email_configured提供(冻结契约)。当前 main 上 worker 尚未返回该字段(ONE-466 后端并行开发中),前端按undefined → false处理,即在后端合入前本分支对所有站点都按「未配置」渲染——这是 §3.1/§3.8 fail-closed 的既定口径,后端合入后自动恢复。email_configured: true)待 ONE-466 合入后回归一次;本次已配置态证据来自 mock(见下),已在子单评论中明示。自测
pnpm lint/pnpm format:check/pnpm typecheck/pnpm build/pnpm test本地全绿(worker 213 passed,基线未动)。web/dist+ mock/api跑 8 组场景截图(zh/en × 未配置/已配置/已启用):FormError。EMAIL_NOT_CONFIGURED→ 切到同一提示态。不在范围
注册邮箱验证、已配置但发信失败的提示、管理员侧新功能、schema / 迁移账本 —— 均未触碰。