Skip to content

fix: 密码登录仍强制要求邮箱验证码,与已合入的后端接口不一致(Refs #156) #169

Description

@huyanxius

问题

#156 已对齐的口径是密码登录不再需要邮箱验证码,验证码只保留给注册、免密登录与重设密码。#149 已按此实现并于 2026-08-07 合入 main:web/api/auth.pyLoginRequest 只有 emailpassword/auth/login 不再接收验证码。

前端仍停在旧口径,四处:

  • frontend/src/entities/user/index.ts:28login() 入参类型仍声明 code: string
  • frontend/src/features/account-panel/index.tsx:180 — 验证码格式校验没有 mode 条件,三种模式一律要求 6 位数字
  • frontend/src/features/account-panel/index.tsx:203session.login() 仍把 code 一并发送
  • frontend/src/features/account-panel/index.tsx:382 — 验证码输入框与「发送验证码」按钮无条件渲染,密码模式下同样出现

另有 index.tsx:35 的模式说明文案仍写「使用密码和邮箱验证码确认身份」。

用户可见的表现:切到「密码登录」页签,填对邮箱和密码也提交不了,必须先走一次邮件往返拿验证码——而这个验证码后端已经不再校验。

目标

前端密码登录路径与后端接口一致,不索取也不发送验证码。免密登录与注册路径的验证码行为保持不变。

范围

只改前端:

  • frontend/src/entities/user/index.tsapi.test.ts
  • frontend/src/features/account-panel/index.tsxindex.test.tsx

不改后端,不动 /auth/send-code 的用途枚举,不动注册与免密登录流程,不涉及 #154 的找回密码。

验收标准

  • 密码模式下界面不出现验证码输入框与发送按钮
  • 只填邮箱与密码即可提交,请求体只含 emailpassword
  • 免密登录模式与注册模式的验证码要求原样保留
  • 模式说明文案不再提及验证码
  • 补测试覆盖两条:密码模式提交的请求体不含 code;密码模式不渲染验证码控件
  • 前端五步验证通过(format、lint、typecheck、test、build)

Refs #156

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions