feat: 支持登录隐藏壳层和路由跳转参数
This commit is contained in:
1 parent
359bd28f2c
commit
0634337858
6 files changed
+40
-13
No files matched your search
@@ -123,7 +123,10 @@ export default function LoginPage() {
|
||||
// taskId,无需把它编进 redirect 值里。目标已自带的同名参数优先(不覆盖);登录鉴权类参数
|
||||
// (token/authToken/ticket 等)一律**不透传**,避免泄漏到应用页地址栏。
|
||||
const redirectTo = useMemo(() => {
|
||||
const raw = searchParams.get('redirect')?.trim() ?? '';
|
||||
const raw =
|
||||
searchParams.get('redirect')?.trim() ||
|
||||
searchParams.get('route')?.trim() ||
|
||||
'';
|
||||
if (!raw) return '';
|
||||
if (/^[a-z][a-z0-9+.-]*:/i.test(raw) || raw.startsWith('//') || raw.includes('\\')) return '';
|
||||
const normalized = raw.startsWith('/') ? raw : `/${raw}`;
|
||||
@@ -131,7 +134,7 @@ export default function LoginPage() {
|
||||
const target = new URLSearchParams(ownQuery);
|
||||
// 登录流程自身消费的参数,不透传到目标页(尤以鉴权类为甚)。
|
||||
const LOGIN_OWNED = new Set([
|
||||
'redirect', 'ticket', 'userId', 'env', 'theme', 'yUserId',
|
||||
'redirect', 'route', 'ticket', 'userId', 'env', 'theme', 'yUserId',
|
||||
'token', 'access_token', 'password', 'authToken', 'goPath', 'from',
|
||||
]);
|
||||
new URLSearchParams(searchParams.toString()).forEach((value, key) => {
|
||||
|
||||
Reference in new issue
Block a user