fix: 无权使用页和管理员登录入口先退出平台当前账号,不再被直接送回

This commit is contained in:
2026-11-03 14:42:41 +08:00
parent 98a3ad5ef2
commit ccc63b1c7e
4 changed files with 10 additions and 8 deletions
+4 -2
View File
@@ -12,6 +12,8 @@ export function appUrl(path: string) {
export const platformHome = "/";
export function platformLoginUrl(target = basePath) {
return `/login?redirect=${encodeURIComponent(target)}`;
/** switchAccount 让平台先退出当前账号再显示登录表单,否则已登录的平台账号会被直接送回来。 */
export function platformLoginUrl(target = basePath, switchAccount = false) {
const url = `/login?redirect=${encodeURIComponent(target)}`;
return switchAccount ? `${url}&switch=1` : url;
}
+2 -2
View File
@@ -36,7 +36,7 @@ export function justBounced() {
return at > 0 && Date.now() - at < BOUNCE_MS;
}
export function goPlatformLogin(target = basePath) {
export function goPlatformLogin(target = basePath, switchAccount = false) {
sessionStorage.setItem(BOUNCE_KEY, String(Date.now()));
window.location.assign(platformLoginUrl(target));
window.location.assign(platformLoginUrl(target, switchAccount));
}