docs: annotate all shared frontend modules in Chinese
This commit is contained in:
1 parent
2be21c1c62
commit
408f8e5c98
55 files changed
+349
No files matched your search
@@ -1,3 +1,4 @@
|
||||
/** 客户端全局鉴权与安全回跳;旧平台凭证入口先脱敏,再由专页向后端确认身份。 */
|
||||
import { defineNuxtRouteMiddleware, navigateTo } from "#app";
|
||||
import { useAuth } from "~/lib/auth.js";
|
||||
import { r as safeRedirect } from "~/lib/auth-redirect.js";
|
||||
@@ -5,6 +6,7 @@ import { isAuthPage, isPublicRoute } from "~/utils/access.js";
|
||||
|
||||
export default defineNuxtRouteMiddleware((to) => {
|
||||
const auth = useAuth();
|
||||
// queryParam 是旧平台携带的敏感 JWT:只进入内存待验证状态,立即从地址和路由中移除。
|
||||
if (to.path === "/home.htm") {
|
||||
if (Object.hasOwn(to.query, "queryParam") || !auth.legacyLoginPending) {
|
||||
auth.prepareLegacyLogin(to.query.queryParam);
|
||||
@@ -27,6 +29,7 @@ export default defineNuxtRouteMiddleware((to) => {
|
||||
}
|
||||
return;
|
||||
}
|
||||
// 非公开页保留安全的站内目的地,但绝不把旧平台凭证夹带进登录 redirect。
|
||||
if (!auth.isLoggedIn && !isPublicRoute(to)) {
|
||||
const query = { ...to.query };
|
||||
delete query.queryParam;
|
||||
@@ -43,6 +46,7 @@ export default defineNuxtRouteMiddleware((to) => {
|
||||
query: redirect === "/" ? {} : { redirect },
|
||||
});
|
||||
}
|
||||
// 已登录用户通常无需返回登录页;OAuth 回调、微信绑定和官网仍允许访问。
|
||||
if (
|
||||
auth.isLoggedIn &&
|
||||
isAuthPage(to.path) &&
|
||||
|
||||
Reference in new issue
Block a user