Fix impersonation: hard navigation + stop impersonating banner
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -4,6 +4,7 @@ import { redirect } from "next/navigation";
|
||||
import Link from "next/link";
|
||||
import { LogoutButton } from "@/components/layout/logout-button";
|
||||
import { getSetting } from "@/lib/settings";
|
||||
import { StopImpersonateBanner } from "@/components/admin/stop-impersonate-banner";
|
||||
|
||||
export default async function StudentLayout({ children }: { children: React.ReactNode }) {
|
||||
const session = await auth.api.getSession({ headers: await headers() });
|
||||
@@ -15,8 +16,11 @@ export default async function StudentLayout({ children }: { children: React.Reac
|
||||
if (maintenance === "true") redirect("/maintenance");
|
||||
}
|
||||
|
||||
const isImpersonating = !!(session.session as { impersonatedBy?: string }).impersonatedBy;
|
||||
|
||||
return (
|
||||
<div className="min-h-screen flex flex-col" style={{ backgroundColor: "var(--background)" }}>
|
||||
{isImpersonating && <StopImpersonateBanner userName={session.user.name} />}
|
||||
<header
|
||||
className="sticky top-0 z-10 flex items-center justify-between px-6 py-3"
|
||||
style={{ borderBottom: "2px solid var(--border)", backgroundColor: "var(--background)" }}
|
||||
|
||||
Reference in New Issue
Block a user