diff --git a/app/(public)/sign-up/page.tsx b/app/(public)/sign-up/page.tsx new file mode 100644 index 0000000..3838dc7 --- /dev/null +++ b/app/(public)/sign-up/page.tsx @@ -0,0 +1,156 @@ +import { headers } from "next/headers"; +import Image from "next/image"; +import Link from "next/link"; +import { redirect } from "next/navigation"; + +import { Button } from "@/components/ui/button"; +import { Input } from "@/components/ui/input"; +import { Label } from "@/components/ui/label"; +import { createClient } from "@/db/server"; + +export default function Component() { + const signUp = async (formData: FormData) => { + "use server"; + + const origin = headers().get("origin"); + const email = formData.get("email") as string; + const password = formData.get("password") as string; + const supabase = createClient(); + + const { error } = await supabase.auth.signUp({ + email, + password, + options: { + emailRedirectTo: `${origin}/auth/callback`, + }, + }); + + if (error) { + return redirect("/sign-up?message=Could not authenticate user"); + } + + return redirect("/sign-in?message=Check email to continue sign in process"); + }; + return ( +
+ Enter your email below to create an account +
+