37 lines
1.3 KiB
TypeScript
37 lines
1.3 KiB
TypeScript
import type { Metadata } from "next";
|
|
import Link from "next/link";
|
|
import { redirect } from "next/navigation";
|
|
import { getServerSession } from "@/lib/auth/guards";
|
|
import { isFlagEnabled } from "@/lib/flags";
|
|
import { SignUpForm } from "@/components/auth/sign-up-form";
|
|
import { Button } from "@/components/ui/button";
|
|
import { Card, CardContent, CardHeader, CardTitle, CardDescription } from "@/components/ui/card";
|
|
|
|
export const metadata: Metadata = { title: "Create account" };
|
|
|
|
export default async function SignUpPage() {
|
|
const session = await getServerSession();
|
|
if (session) redirect("/dashboard");
|
|
|
|
if (!(await isFlagEnabled("signups_enabled"))) {
|
|
return (
|
|
<Card className="rounded-3xl shadow-md">
|
|
<CardHeader className="pb-2">
|
|
<CardTitle className="text-2xl">Sign-ups are paused</CardTitle>
|
|
<CardDescription>
|
|
New account registration is temporarily closed. Please check back soon.
|
|
</CardDescription>
|
|
</CardHeader>
|
|
<CardContent>
|
|
<Button asChild variant="outline" className="w-full">
|
|
<Link href="/sign-in">Back to sign in</Link>
|
|
</Button>
|
|
</CardContent>
|
|
</Card>
|
|
);
|
|
}
|
|
|
|
const googleEnabled = !!(process.env.GOOGLE_CLIENT_ID && process.env.GOOGLE_CLIENT_SECRET);
|
|
return <SignUpForm googleEnabled={googleEnabled} />;
|
|
}
|