Skip to content

feat(guide): 建号步骤改走 /api/auth/setup - #128

Merged
Yundi339 merged 1 commit into
mainfrom
feat/guide-account-setup
Nov 29, 2026
Merged

Yundi339 merged 1 commit into
mainfrom
feat/guide-account-setup

Conversation

@Yundi339

@Yundi339 Yundi339 commented Nov 29, 2026 •

Copy link
Copy Markdown
Member

说明

面板新手引导的建号步骤还在打旧接口 /api/password,而 Web 向导和登录页已切到会话认证的 POST /api/auth/setup,密码规则由主机在该接口统一执行。面板因此绕开了主机的建号规则,和 Web 端行为不一致。

另外,跳过建号后面板首页没有任何提示补建(远程浏览器进不了没有账号的首页,但面板经本机代理可以)。

修改

  • 引导建号改调 POST /api/auth/setup,请求体改为 {username, password}
  • 409(账号已在其他入口创建)按成功处理:面板不登录,引导照常继续
  • 主机返回的错误文本原样透传,与面板现有错误样式一致
  • 首页在 /api/auth/session 报告 setup_required 时显示引导横幅(一行内文案 + 红色按钮),点击打开建号页:引导只保留账号一步,建完或关闭即回首页;18 个语言表新增对应文案,其余语言回退英文

@coderabbitai

coderabbitai Bot commented Nov 29, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Summary by CodeRabbit

  • 功能调整

    • 账户创建改为提交用户名和密码;服务端确认设置已完成时也会视为成功。
  • 错误处理

    • 创建失败时显示服务端错误信息;密码长度错误会提供本地化提示。

Walkthrough

账户创建改为向 /api/auth/setup 提交用户名和密码。成功条件包括通过状态检查的 HTTP 成功响应,以及 HTTP 409。测试覆盖成功和密码长度错误。

Changes

账户设置流程

层 / 文件 摘要
设置请求与响应处理
src/renderer/composables/guideData.js, src/renderer/composables/guideData.test.js
createAccount 改为提交 { username, password }。通过状态检查的 HTTP 成功响应和 HTTP 409 返回成功;其他响应返回翻译后的错误信息。测试覆盖成功、HTTP 409 和 HTTP 400 密码长度错误。

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: skyhua0224

Merge Risk: Minimal · up to 9647b

Account creation now posts the username and password to /api/auth/setup, treats HTTP 409 as success, and shows host error text unchanged. No concrete defect was established. The only open question is whether every supported host version returns status: true on success, which can't be confirmed from this repository.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed 标题“feat(guide): 建号步骤改走 /api/auth/setup”描述了本次主要变更:引导流程的建号请求从 /api/password 改为 /api/auth/setup。变更摘要与目标均与此一致。
Description check Passed 描述说明了变更原因(引导建号仍用旧接口 /api/password,Web 端已切换到 POST /api/auth/setup)、请求体改为 {username, password}、409 按成功处理且不登录,以及错误文本原样透传。与变更内容直接相关。
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 008d24e and 9647bee.

Files selected for processing: 2

  • src/renderer/composables/guideData.js
  • src/renderer/composables/guideData.test.js

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

Recent review details

Context from checks skipped due to timeout: 1

  • GitHub Check: Changes
Additional context used

Path-based instructions: 1

这是 Vue 3、Vite 和 Tauri API 的前端代码。重点检查异步错误处理、IPC 调用边界、 外部数据校验、资源清理、状态竞态、XSS/CSRF 风险以及跨 WebView 窗口行为。

CodeRabbit configuration file

Files:

  • src/renderer/composables/guideData.js
  • src/renderer/composables/guideData.test.js
Betterleaks (1.9.0)

src/renderer/composables/guideData.test.js

[low] 53-53: Detected a potential hardcoded password literal, which may expose account credentials. Found in a test, fixture or example file. The same value appears in 2 other places in this change.

(generic-password)

Additional comments: 1

src/renderer/composables/guideData.js: 1

249-249: Data Integrity & Integration

The finding that a successful /api/auth/setup response may lack an accepted status is not supported by the inspected repository. The only evidence for this route's success shape is the panel's own { status: true } expectation and its fixture. No host implementation or versioned contract in the checkout shows that a 200 response can omit status, so the claimed premise is unverified. The 409 branch, the error-text passthrough, and the network-failure catch all match the stated PR intent and need no correction.

@Yundi339
Yundi339 merged commit 2243385 into main Nov 29, 2026
10 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.

1 participant