2026-06-09 13:49:22 +05:30
|
|
|
import { StackHandler, StackTheme } from "@stackframe/stack";
|
2025-09-09 14:37:32 +05:30
|
|
|
|
2026-02-20 18:21:24 +05:30
|
|
|
import { getAuthProvider } from "@/lib/auth/config";
|
2025-09-09 14:37:32 +05:30
|
|
|
|
2026-06-09 13:49:22 +05:30
|
|
|
import { AuthEnterpriseCTA } from "./AuthEnterpriseCTA";
|
|
|
|
|
import { AuthShell } from "./AuthShell";
|
2026-03-16 15:04:08 +05:30
|
|
|
import { BackButton } from "./BackButton";
|
2026-06-09 13:49:22 +05:30
|
|
|
import { stackAuthDarkTheme } from "./stack-theme";
|
2026-03-16 15:04:08 +05:30
|
|
|
|
2026-02-20 18:21:24 +05:30
|
|
|
export default async function Handler(props: unknown) {
|
|
|
|
|
const authProvider = await getAuthProvider();
|
2025-09-09 14:37:32 +05:30
|
|
|
|
|
|
|
|
if (authProvider === "local") {
|
|
|
|
|
return (
|
2026-06-09 13:49:22 +05:30
|
|
|
<AuthShell enterpriseSlot={<AuthEnterpriseCTA />}>
|
|
|
|
|
<div className="space-y-2 text-center text-zinc-200">
|
|
|
|
|
<h1 className="text-xl font-semibold">Local Auth Mode</h1>
|
|
|
|
|
<p className="text-sm text-muted-foreground">
|
|
|
|
|
Stack Auth handler is disabled when using local authentication.
|
|
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
</AuthShell>
|
2025-09-09 14:37:32 +05:30
|
|
|
);
|
|
|
|
|
}
|
2026-02-20 18:21:24 +05:30
|
|
|
|
|
|
|
|
// Lazily import the real StackServerApp only when needed
|
|
|
|
|
const { getStackServerApp } = await import("@/lib/auth/server");
|
|
|
|
|
const app = await getStackServerApp();
|
|
|
|
|
|
2026-03-16 15:04:08 +05:30
|
|
|
return (
|
2026-06-09 13:49:22 +05:30
|
|
|
<AuthShell enterpriseSlot={<AuthEnterpriseCTA />}>
|
2026-03-16 15:04:08 +05:30
|
|
|
<BackButton />
|
2026-06-09 13:49:22 +05:30
|
|
|
<StackTheme theme={stackAuthDarkTheme}>
|
|
|
|
|
<StackHandler fullPage={false} app={app!} routeProps={props} />
|
|
|
|
|
</StackTheme>
|
|
|
|
|
</AuthShell>
|
2026-03-16 15:04:08 +05:30
|
|
|
);
|
2025-09-09 14:37:32 +05:30
|
|
|
}
|