fix: 修复分享链接路由与登录回跳

- 统一生成包含部署基路径和 Hash 路由的知识库、工作流分享地址

- 未登录访问分享页时保留目标地址,并在登录成功后自动回跳

- 限定分享密钥作用域并补充失效、加载失败及回归测试
This commit is contained in:
2026-07-24 16:00:57 +08:00
parent 41545fcef0
commit 526e16163b
15 changed files with 465 additions and 71 deletions

View File

@@ -18,11 +18,12 @@ import {
logoutApi,
} from '#/api';
import { $t } from '#/locales';
import { clearAgentChatBrowserCache } from '#/utils/agent-chat-cache';
import { resolveLoginRedirectPath } from '#/utils/login-redirect';
import {
buildForcePasswordRoute,
shouldForcePasswordChange,
} from '#/utils/password-reset';
import { clearAgentChatBrowserCache } from '#/utils/agent-chat-cache';
export const useAuthStore = defineStore('auth', () => {
const accessStore = useAccessStore();
@@ -67,9 +68,16 @@ export const useAuthStore = defineStore('auth', () => {
} else if (!options.skipRedirect) {
const homePath =
userInfo.homePath || preferences.app.defaultHomePath || '/';
options.onSuccess
? await options.onSuccess()
: await router.push(homePath);
const redirectPath = resolveLoginRedirectPath(
router.currentRoute.value.query.redirect,
);
if (options.onSuccess) {
await options.onSuccess();
} else if (redirectPath) {
await router.replace(redirectPath);
} else {
await router.push(homePath);
}
}
if (options.notify !== false && userInfo?.nickname) {