Quellcode durchsuchen

fix: 权限不足时跳403而非/,避免无限循环导致栈溢出

非管理员访问 /dashboard 时,原 next('/') 触发 Layout redirect 回 /dashboard,
形成 '/dashboard → / → /dashboard → …' 无限循环。
改为 next('/403') 直接跳 403 页面,终止循环。
iwt vor 1 Monat
Ursprung
Commit
9fc9d4874b
1 geänderte Dateien mit 1 neuen und 1 gelöschten Zeilen
  1. 1 1
      cfc-web/src/router/index.js

+ 1 - 1
cfc-web/src/router/index.js

@@ -793,7 +793,7 @@ router.beforeEach(async (to, from, next) => {
     const perms = getEffectivePermissions(roles)
     if (!hasPermission(perms, requiredPerm)) {
       console.warn('Access denied: insufficient permissions for', to.name)
-      return next({ path: '/', query: { accessDenied: 'no-permission' }, replace: true })
+      return next({ path: '/403', replace: true })
     }
   }
   return next()