Harden production auth for hackathon demo.
Configure Supabase redirect URLs, disable email confirmation on the remote project, create profile and avatar rows on signup, and route new users to /protected when a session is returned immediately. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -40,14 +40,18 @@ export function SignUpForm({
|
||||
}
|
||||
|
||||
try {
|
||||
const { error } = await supabase.auth.signUp({
|
||||
const { data, error } = await supabase.auth.signUp({
|
||||
email,
|
||||
password,
|
||||
options: {
|
||||
emailRedirectTo: `${window.location.origin}/protected`,
|
||||
emailRedirectTo: `${window.location.origin}/auth/confirm?next=/protected`,
|
||||
},
|
||||
});
|
||||
if (error) throw error;
|
||||
if (data.session) {
|
||||
router.push("/protected");
|
||||
return;
|
||||
}
|
||||
router.push("/auth/sign-up-success");
|
||||
} catch (error: unknown) {
|
||||
setError(error instanceof Error ? error.message : "An error occurred");
|
||||
|
||||
Reference in New Issue
Block a user