From ec4c390e1f8c8e11f5b0be8d61056c3a0d0187ce Mon Sep 17 00:00:00 2001 From: Takagi Date: Wed, 27 Mar 2024 21:14:06 +0800 Subject: [PATCH] fix: wrong router navigation when redirect to /uc (#5609) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #### What type of PR is this? /kind bug /area ui #### What this PR does / why we need it: 修复当角色勾选禁止访问 Console 后,redirect_uri 参数无效的问题 #### How to test it? 测试角色禁止访问 console 时,当链接中携带 redirect_uri 参数,能否正常跳转 #### Which issue(s) this PR fixes: Fixes #5417 #### Does this PR introduce a user-facing change? ```release-note 修复当角色禁止访问 Console 后,redirect_uri 参数无效的问题 ``` --- ui/console-src/router/guards/auth-check.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ui/console-src/router/guards/auth-check.ts b/ui/console-src/router/guards/auth-check.ts index 12950f307..203ae12f1 100644 --- a/ui/console-src/router/guards/auth-check.ts +++ b/ui/console-src/router/guards/auth-check.ts @@ -2,7 +2,7 @@ import { rbacAnnotations } from "@/constants/annotations"; import { useUserStore } from "@/stores/user"; import type { Router } from "vue-router"; -const whiteList = ["Setup", "Login", "Binding", "ResetPassword"]; +const whiteList = ["Setup", "Login", "Binding", "ResetPassword", "Redirect"]; export function setupAuthCheckGuard(router: Router) { router.beforeEach((to, from, next) => { @@ -52,7 +52,7 @@ export function setupAuthCheckGuard(router: Router) { return; } - if (to.name === "whiteList") { + if (to.name && whiteList.includes(to.name as string)) { next(); return; }