Repository navigation
feat(auth): 注册/登录完成后支持按 redirect_uri 回跳第一方站点 - #6
Merged
Merged
Conversation
- 新增 redirect.js:仅允许 https 的 ssemarket.cn 及子域(localhost 开发例外), 防止开放重定向 - 注册页读取 redirect_uri:普通注册带到 /verify-email,邀请码注册成功即整页回跳 - 登录页(密码/扫码)成功后同样优先回跳第一方站点 - 已登录用户访问 /register 或 /login 时直接回跳,不再落到 /profile - 注册页“已有账号?登录”保留回跳地址 Co-Authored-By: Claude <noreply@anthropic.com>
避免用户在注册验证页改走登录时丢掉 redirect_uri。 Co-Authored-By: Claude <noreply@anthropic.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.
问题
从集市点「注册」跳到
sso.ssemarket.cn/register后,注册成功仍停留在 SSO 前端(router.push('/')),不会回到集市。方案
redirect_uri=<绝对地址>(配套主站 PR 见下方)。frontend/src/redirect.js:ssemarket.cn/*.ssemarket.cn(localhost开发例外),其余一律忽略,避免把 SSO 变成开放重定向器。redirect_uri/redirect_url/return_to三种参数名。redirect_uri;redirect_uri带到/verify-email,验证成功后跳回;next行为。/register或/login时直接回跳,不再落到/profile。验证
vite build通过(产物在临时目录,不提交构建结果)safeRedirect用例:允许https://ssemarket.cn/new/及子域;拒绝https://evil.com、https://ssemarket.cn.evil.com、http://ssemarket.cn、//evil.com、javascript:redirect_uri时行为不变(站内/或next)注意
回跳后集市是否免登录,取决于共享
unisso_sidCookie;若没有,会停在集市登录页,用刚注册的账号登录即可。本次不改变 SSO 的会话/Cookie 模型。配套主站 PR:SysuMirror/SSEMarket-Client#2