Преглед на файлове

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

非管理员访问 /dashboard 时,原 next('/') 触发 Layout redirect 回 /dashboard,
形成 '/dashboard → / → /dashboard → …' 无限循环。
改为 next('/403') 直接跳 403 页面,终止循环。
iwt преди 1 месец
родител
ревизия
9fc9d4874b
променени са 1 файла, в които са добавени 1 реда и са изтрити 1 реда
  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()