From a6d44f2ddb085c3067d73475091ad2b4fbbec8a6 Mon Sep 17 00:00:00 2001 From: v0 Date: Wed, 11 Mar 2026 07:03:45 +0000 Subject: [PATCH] fix: move invite code check to server action for new users Remove client-side invite code validation to avoid RLS issues. Co-authored-by: Moheeb Zara <1184415+virgilvox@users.noreply.github.com> --- app/signup/page.tsx | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/app/signup/page.tsx b/app/signup/page.tsx index 812500c..a7937f7 100644 --- a/app/signup/page.tsx +++ b/app/signup/page.tsx @@ -79,12 +79,8 @@ export default function SignupPage() { const supabase = createClient() if (mode === 'join') { - const { data: space, error: lookupErr } = await supabase - .from('spaces') - .select('id') - .eq('invite_code', inviteCode.trim().toUpperCase()) - .single() - if (lookupErr || !space) { setError('Invalid invite code'); setLoading(false); return } + // Invite code is validated server-side in joinSpace (uses admin client, bypasses RLS). + // Do NOT pre-validate here with the regular client — RLS blocks unauthenticated lookups. } const metadata: Record = {