feat(auth): 前端接入 Discord 登录 + 设置页登录方式管理#382
Merged
Merged
Conversation
配合后端 Discord provider(involutionhell-backend#48): - next.config.mjs:OAuth 回调 rewrite 从硬编码 /api/auth/callback/github 泛化为 /api/auth/callback/:provider——否则 Discord 回调漏代理 → 404(登录跑不通的阻断项) - 登录页加"用 Discord 登录"按钮;SignInButton 参数化 provider(header 处默认 github 不变) - 设置页加"登录方式"区:列出已绑定身份 + 解绑(后端 M2a)。最后一种登录方式 的解绑按钮禁用(防锁死,后端也有兜底) - i18n:login.github/discord、settings.linked.* 暂不加"连接 Discord"按钮:绑定流程(M2b)未上线前,点它只会把用户登成新账号(分叉)。 typecheck / lint(0 error)/ build 通过;/login 仍 ● SSG。
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
longsizhuo
added a commit
that referenced
this pull request
Jul 19, 2026
#382 把 GitHub/Discord 两个按钮放在了 /login 页,但 header 的 "Sign In" (AuthNav 里 <SignInButton /> 无 provider)仍直跳 /oauth/render/github, 用户点了就直奔 GitHub、根本看不到 Discord 选项。 改:SignInButton 不传 provider 时跳 /login 选择页;登录页两个按钮传了 provider 仍直跳对应授权。header 无 props 调用自动获得"先选后登"。 Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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.
配合后端 Discord provider(involutionhell-backend#48,已合 main)。这是"Discord 登录"的前端一半。
改动
next.config.mjs(关键阻断修复):OAuth 回调 rewrite 从硬编码/api/auth/callback/github泛化为/api/auth/callback/:provider。原来 Discord 回调/api/auth/callback/discord漏代理 → 落到 Vercel 前端 404,登录整个跑不通。SignInButton参数化provider(header 处无 props 调用默认 github,不变);登录页并列 GitHub / Discord 两个按钮。LinkedAccounts.tsx):列出已绑定身份 + 解绑,用后端 M2a 的GET/DELETE /api/user-center/identities。最后一种登录方式的解绑按钮禁用(前端防呆,后端也有 400 兜底)。login.github/discord、settings.linked.*(中英)。验证
pnpm typecheck/pnpm lint(0 error)/pnpm build通过;/login仍●SSG(/settings是既有的ƒ,非本 PR 引入)。/oauth/render/discord后端还不认。${AUTH_URL}/api/auth/callback/discord)+ Discord 后台把 Public Client 关掉。🤖 Generated with Claude Code
https://claude.ai/code/session_01RtSNVtrEkCsFVHrbt4Zjgi