fix(ui): 修复登录和并发请求并统一页面展示

调整登录流程和请求处理,统一各中心的表格交互、主题样式和页面展示。
This commit is contained in:
zhanjunhao
2026-11-19 18:58:46 +08:00
parent 9b6eb1c7c4
commit 7908ed53a3
128 changed files with 4672 additions and 5391 deletions
+35 -3
View File
@@ -145,11 +145,43 @@ export function isSafePostLoginRedirect(path) {
export function savePostLoginRedirect(path) {
if (isSafePostLoginRedirect(path)) {
sessionStorage.setItem(POST_LOGIN_REDIRECT_KEY, path);
} else {
sessionStorage.removeItem(POST_LOGIN_REDIRECT_KEY);
}
}
export function consumePostLoginRedirect(defaultPath = DEFAULT_LOGIN_REDIRECT) {
const path = sessionStorage.getItem(POST_LOGIN_REDIRECT_KEY);
export function consumePostLoginRedirect({
redirect = sessionStorage.getItem(POST_LOGIN_REDIRECT_KEY),
enterprise = false,
orgOnly = false,
} = {}) {
sessionStorage.removeItem(POST_LOGIN_REDIRECT_KEY);
return isSafePostLoginRedirect(path) ? path : defaultPath;
const fallback = enterprise
? '/org/workbench'
: orgOnly
? '/org'
: DEFAULT_LOGIN_REDIRECT;
if (!isSafePostLoginRedirect(redirect)) return fallback;
let normalizedPath;
try {
const base = 'https://login.invalid';
const target = new URL(redirect, base);
if (target.origin !== base) return fallback;
normalizedPath =
decodeURI(target.pathname).toLowerCase().replace(/\/+$/, '') || '/';
} catch {
return fallback;
}
if (
!isSafePostLoginRedirect(normalizedPath) ||
normalizedPath === '/forbidden' ||
normalizedPath === '/user/reset'
)
return fallback;
if (!enterprise && !orgOnly && /^\/org(?:\/|$)/.test(normalizedPath))
return fallback;
if ((enterprise || orgOnly) && /^\/console(?:\/|$)/.test(normalizedPath))
return fallback;
return redirect;
}