Skip to content

Account verification - #7418

Open
shortlight5980 wants to merge 2 commits into
labring:account-perffrom
shortlight5980:account-verification
Open

Account verification#7418
shortlight5980 wants to merge 2 commits into
labring:account-perffrom
shortlight5980:account-verification

Conversation

@shortlight5980

Copy link
Copy Markdown
Collaborator
  1. 去除auth_code,增加tmp_datas的verification层包装,upsert和consume两个通用操作
  2. 微信扫码实现过期刷新(5min过期)
  3. 验证码校验1分钟10次限制

@github-actions

github-actions Bot commented Jul 30, 2026

Copy link
Copy Markdown

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 21.26% 1901 / 8940
🔵 Statements 21.25% 1994 / 9382
🔵 Functions 18.04% 387 / 2145
🔵 Branches 17.14% 867 / 5056
File CoverageNo changed files found.
Generated in workflow #1880 for commit 879b08b by the Vitest Coverage Report Action

@github-actions

github-actions Bot commented Jul 30, 2026

Copy link
Copy Markdown

Admin Preview Image Ready!

ghcr.io/labring/fastgpt-pr:admin_879b08b6f31535d674a5acc17247eb2411ab0c47

🕒 Time: 2026-07-31 18:03:00 (UTC+8)

@github-actions

github-actions Bot commented Jul 30, 2026

Copy link
Copy Markdown

Build Successful - Preview fastgpt Image for this PR:

ghcr.io/labring/fastgpt-pr:fastgpt_879b08b6f31535d674a5acc17247eb2411ab0c47

🕒 Time: 2026-07-31 18:06:08 (UTC+8)

@c121914yu
c121914yu changed the base branch from main to account-perf July 31, 2026 01:48

@c121914yu c121914yu left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Review result: no actionable findings in this PR after checking the tmp_datas verification wrapper, password pre-login flow, OAuth start/callback client wiring, WeChat QR expiry refresh, send-code caller migration, API schema/status handling, and tests. Note: the companion fastgpt-pro PR still has a blocking send-code type/purpose validation issue that should be fixed before the stack merges.

Comment thread projects/app/src/pageComponents/login/LoginForm/FormLayout.tsx

@c121914yu c121914yu left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

PR 审查报告

需求理解

本次改动把密码、验证码、微信和 OAuth 验证材料统一迁移到 tmp_datas,通过带过期条件的原子消费提高一次性验证安全性,并新增 OAuth 服务端事务、微信二维码过期刷新和验证码尝试频控。

逻辑验证

已走查密码登录成功/错误验证码、验证码第 11 次触发限流、OAuth 一次性 state、微信未扫码/过期刷新等主流程。目标测试共 62 个通过(Service 16、App 46)。另外使用 NEXT_PUBLIC_BASE_URL=/fastgpt 重跑 Pro OAuth flow,10 个用例中 5 个因 Invalid OAuth redirect URI 失败,复现了行评中的 basePath 回归。该 PR 当前 GitHub CI 全部通过。

问题统计

  • 严重问题:2
  • 建议改进:1

做得好的地方

consume 使用 findOneAndDelete 同时约束 expireAt 和材料内容,避免了先查后删的重复消费窗口;代理层也补了多 Set-Cookie 转发测试。

审查结论

需要修改。请先修复 basePath OAuth 和 auth_codes -> tmp_datas 的兼容发布问题;错误状态映射建议一并收紧。

Comment thread projects/app/src/pageComponents/login/LoginForm/FormLayout.tsx Outdated
Comment thread packages/service/support/tmpData/verification.ts
Comment thread packages/service/common/response/index.ts Outdated
@shortlight5980

Copy link
Copy Markdown
Collaborator Author

执行:
MONGODB_URI="<MongoDB 地址>" pnpm --filter @fastgpt/app run migrate:auth-code -- --dry-run
MONGODB_URI="<MongoDB 地址>" pnpm --filter @fastgpt/app run migrate:auth-code -- --execute
默认是 dry-run,--execute 才写入 tmp_datas,不会删除 auth_codes。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants