인증 경로 보존과 의존성 보안 검증을 보강
This commit is contained in:
parent
d2ba836565
commit
d801a1619d
10 changed files with 222 additions and 77 deletions
|
|
@ -162,7 +162,7 @@ function RequireAuth({
|
|||
|
||||
if (loading) return <BootScreen />;
|
||||
if (!user) {
|
||||
return <Navigate to="/login" replace state={{ from: location.pathname }} />;
|
||||
return <Navigate to="/login" replace state={{ from: `${location.pathname}${location.search}${location.hash}` }} />;
|
||||
}
|
||||
if (roles && !roles.some((role) => canAccessRole(user, role))) {
|
||||
return <Navigate to={roleHomePath(user.role)} replace />;
|
||||
|
|
@ -189,7 +189,7 @@ function OnboardingGate({ children }: { children: ReactNode }) {
|
|||
if (isAdminWorkspacePath(path) && canAccessRole(user, "admin")) {
|
||||
return <>{children}</>;
|
||||
}
|
||||
return <Navigate to="/onboarding" replace state={{ from: path }} />;
|
||||
return <Navigate to="/onboarding" replace state={{ from: `${path}${location.search}${location.hash}` }} />;
|
||||
}
|
||||
if (
|
||||
user &&
|
||||
|
|
@ -208,7 +208,7 @@ function PendingApprovalGate({ children }: { children: ReactNode }) {
|
|||
|
||||
if (loading) return <BootScreen />;
|
||||
if (user && user.accountStatus !== "approved" && path !== "/pending") {
|
||||
return <Navigate to="/pending" replace state={{ from: path }} />;
|
||||
return <Navigate to="/pending" replace state={{ from: `${path}${location.search}${location.hash}` }} />;
|
||||
}
|
||||
if (user && user.accountStatus === "approved" && path === "/pending") {
|
||||
return <Navigate to={approvedHomePath(user)} replace />;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue