2025-06-04 23:42:52 +00:00
|
|
|
import { auth } from "@/auth";
|
|
|
|
|
import { LoginForm } from "../login/components/loginForm";
|
|
|
|
|
import { redirect } from "next/navigation";
|
|
|
|
|
import { Footer } from "@/app/components/footer";
|
|
|
|
|
import { createLogger } from "@sourcebot/logger";
|
2025-07-15 03:14:41 +00:00
|
|
|
import { getAuthProviders } from "@/lib/authProviders";
|
|
|
|
|
import { getOrgFromDomain } from "@/data/org";
|
|
|
|
|
import { SINGLE_TENANT_ORG_DOMAIN } from "@/lib/constants";
|
2025-06-04 23:42:52 +00:00
|
|
|
|
|
|
|
|
const logger = createLogger('signup-page');
|
|
|
|
|
|
|
|
|
|
interface LoginProps {
|
|
|
|
|
searchParams: {
|
|
|
|
|
callbackUrl?: string;
|
|
|
|
|
error?: string;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default async function Signup({ searchParams }: LoginProps) {
|
|
|
|
|
const session = await auth();
|
|
|
|
|
if (session) {
|
|
|
|
|
logger.info("Session found in signup page, redirecting to home");
|
|
|
|
|
return redirect("/");
|
|
|
|
|
}
|
|
|
|
|
|
2025-07-15 03:14:41 +00:00
|
|
|
const org = await getOrgFromDomain(SINGLE_TENANT_ORG_DOMAIN);
|
|
|
|
|
if (!org || !org.isOnboarded) {
|
|
|
|
|
return redirect("/onboard");
|
|
|
|
|
}
|
2025-06-04 23:42:52 +00:00
|
|
|
|
2025-07-15 03:14:41 +00:00
|
|
|
const providers = getAuthProviders();
|
2025-06-04 23:42:52 +00:00
|
|
|
return (
|
|
|
|
|
<div className="flex flex-col min-h-screen bg-backgroundSecondary">
|
|
|
|
|
<div className="flex-1 flex flex-col items-center p-4 sm:p-12 w-full">
|
|
|
|
|
<LoginForm
|
|
|
|
|
callbackUrl={searchParams.callbackUrl}
|
|
|
|
|
error={searchParams.error}
|
2025-07-15 03:14:41 +00:00
|
|
|
providers={providers}
|
2025-06-04 23:42:52 +00:00
|
|
|
context="signup"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
<Footer />
|
|
|
|
|
</div>
|
|
|
|
|
)
|
|
|
|
|
}
|