Skip to content

Show check-your-inbox message when signup needs email confirmation - #362

Merged
daniellehonn merged 1 commit into
membership_portalfrom
fix/265-signup-email-confirmation
Nov 5, 2026
Merged

daniellehonn merged 1 commit into
membership_portalfrom
fix/265-signup-email-confirmation

Conversation

@bryanzhang3

Copy link
Copy Markdown
Contributor

Closes #265

What changed

  • Signup page: when signUp returns no session (Supabase "Confirm email" is on), the page now shows a "Check your UCLA inbox to confirm your account" message instead of redirecting to /portal (which bounced to /login). It also skips the browser profiles upsert in that case, since there's no session to run it with.
  • The confirmation link now redirects to /login (emailRedirectTo).
  • With "Confirm email" off, behavior is unchanged.

Database change (already applied to Supabase)

The existing on_auth_user_created trigger on auth.users already created the profile row, but only set id, email and display_name. I updated public.handle_new_user() so it also copies first_name / last_name (trimmed) from the signup metadata. Without this, new members signing up with confirmation on would have no first/last name. Migration name: handle_new_user_copy_first_last_name.

SQL
create or replace function public.handle_new_user()
returns trigger
language plpgsql
security definer
as $function$
declare
  first_name text := nullif(trim(new.raw_user_meta_data->>'first_name'), '');
  last_name  text := nullif(trim(new.raw_user_meta_data->>'last_name'), '');
  computed_display_name text;
begin
  if first_name is not null and last_name is not null then
    computed_display_name := first_name || ' ' || last_name;
  else
    computed_display_name := split_part(new.email, '@', 1);
  end if;

  insert into public.profiles (id, email, display_name, first_name, last_name)
  values (new.id, new.email, computed_display_name, first_name, last_name)
  on conflict (id) do update
    set email = excluded.email,
        display_name = excluded.display_name,
        first_name = excluded.first_name,
        last_name = excluded.last_name;

  return new;
end;
$function$;

Testing

With "Confirm email" turned on in Supabase, I signed up with a new UCLA address on localhost:

  • Page showed the check-your-inbox message
  • Confirmation email arrived; clicking it confirmed the account
  • Logged in afterward
  • profiles row had the correct first_name, last_name and display_name

"Confirm email" is now left on in Supabase.

Before launch: check SMTP

Check Authentication → Emails → SMTP Settings in Supabase. If the project still uses Supabase's built-in email sender, it only delivers to Supabase team members and is heavily rate-limited, so real members won't receive confirmation emails. If that's the case, set up a custom SMTP provider (e.g. Resend) before members start signing up.

@netlify

netlify Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for cl-portal-ucla ready!

Name Link
🔨 Latest commit 19cdede
🔍 Latest deploy log https://app.netlify.com/projects/cl-portal-ucla/deploys/6ae3e159d35624dd7b855ae2
😎 Deploy Preview https://deploy-preview-362--cl-portal-ucla.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@daniellehonn
daniellehonn merged commit db413a5 into membership_portal Nov 5, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants