Skip to content

fix(account-panel): drop the email code from password login - #170

Merged
huyanxius merged 1 commit into
1024XEngineer:mainfrom
huyanxius:fix/169-password-login-drop-code
Aug 7, 2026
Merged

fix(account-panel): drop the email code from password login#170
huyanxius merged 1 commit into
1024XEngineer:mainfrom
huyanxius:fix/169-password-login-drop-code

Conversation

@huyanxius

Copy link
Copy Markdown
Collaborator

前端密码登录路径去掉邮箱验证码,与 #149 已合入的后端 /auth/login 对齐。

Closes #169

Why

#156 讨论定下的口径是密码登录不再需要验证码,验证码只保留给注册、免密登录与重设密码。后端已在 #149 落地,LoginRequest 现在只有 emailpassword

前端没跟上,而且症状不是"多发一个字段被后端忽略"这么轻。validate() 里的验证码格式校验对三种模式一视同仁,所以在密码登录页签填对邮箱和密码也提交不了,用户必须先走一次邮件往返,去拿一个后端根本不会校验的验证码。按 #156 的描述,换设备或清理浏览器数据之后重新登录就会撞上这条路径。

Change Description

5 个文件,+41 −46。

  • entities/user/index.tslogin() 入参类型去掉 code
  • features/account-panel/index.tsx:密码模式跳过验证码校验、不再渲染验证码输入框与发送按钮、提交载荷去掉 code、模式说明文案改写
  • 三个测试文件跟随调整

免密登录与注册两条路径的验证码行为完全不动。

Implementation Approach

  • 门控条件统一用 mode !== 'password',一处管校验、一处管渲染,不引入新的 state
  • 先收窄类型再改实现。UserApis['login'] 去掉 code 之后 tsc 会把所有还在传 code 的调用点报出来,其中 features/auth-session/index.test.tsx 不在 issue 声明的范围里——它不是夹带,是类型收窄的编译强制连带,不改则 typecheck 与 build 都不过
  • code state 与 60 秒冷却逻辑原样保留,免密登录和注册仍在用

Screenshots

密码登录页签,改动前后:

Before After

改动前多出「验证码」输入框与「发送验证码」按钮,说明文案是「使用密码和邮箱验证码确认身份。」;改动后只剩邮箱与密码两项,文案改为「用邮箱和密码直接登录。」

Testing

本地跑了 frontend-ci.yml 的全部五步:

  • npm run format:check — 通过,85 个文件
  • npm run lint — 通过
  • npm run typecheck — 通过
  • npm run test — 通过,24 个文件 146 个用例
  • npm run build — 通过

另外用一个干净上下文的子代理做了独立验收。它自己重跑了这五步,并做了变异测试:把 code 加回提交载荷、把验证码 UI 改成无条件渲染、把 validate() 的 mode 条件去掉、把 login() 类型改回要求 code,四处都能让对应检查变红,确认这些测试挡得住回归。文案那条验收标准最初没有测试守护,是它指出来的,已补上断言并验证过能红。

Follow-ups

Related

1024XEngineer#156 已对齐的口径是验证码只保留给注册、免密登录与重设密码,1024XEngineer#149 合入的后端 /auth/login 也已经不再接收它。

收窄 login 的入参类型,密码模式跳过验证码校验、不再渲染验证码输入框与发送按钮,提交时只发邮箱和密码。

密码登录现在填账号密码即可完成,与后端接受的请求体一致。
@vercel

vercel Bot commented Aug 7, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
windup Ready Ready Preview Aug 7, 2026 9:54am

@fennoai fennoai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found in this review.

Verification note: I could not rerun the frontend checks in this workspace because the local npm script executables (vitest, tsc, and oxlint) returned Permission denied.

@xiaocheny214 xiaocheny214 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR #170:没有问题,可以合入

@huyanxius
huyanxius merged commit 2231b9a into 1024XEngineer:main Aug 7, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants