From 3aa41f878483ba2fec1b05793a8cca8a43d05f5c Mon Sep 17 00:00:00 2001 From: "Builder.io" Date: Fri, 17 Oct 2025 23:46:11 +0000 Subject: [PATCH] Prefer Supabase SMTP for verification emails; fallback to server endpoint cgen-6dc427ca42924f7982520fb28ca57b69 --- client/components/onboarding/Welcome.tsx | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/client/components/onboarding/Welcome.tsx b/client/components/onboarding/Welcome.tsx index dcc5bfdd..6dadda03 100644 --- a/client/components/onboarding/Welcome.tsx +++ b/client/components/onboarding/Welcome.tsx @@ -83,6 +83,21 @@ export default function Welcome({ setFallbackVerificationLink(null); try { + // First try Supabase to send via your configured SMTP + const { error: resendError } = await supabase.auth.resend({ + type: "signup", + email: emailAddress, + } as any); + + if (!resendError) { + toastSuccess({ + title: "Verification email sent", + description: `We sent a confirmation message to ${emailAddress}.`, + }); + return; + } + + // Fallback to server-generated link (and optional Resend delivery) const redirectTo = typeof window !== "undefined" ? `${window.location.origin}/login?verified=1` @@ -103,7 +118,6 @@ export default function Welcome({ .catch(() => ({}) as Record); if (!response.ok) { - // If server returned a manual verification link despite the error, surface it to the user. const manualLink = typeof payload?.verificationUrl === "string" ? payload.verificationUrl @@ -126,8 +140,6 @@ export default function Welcome({ "Failed to send verification email", }); } - - setIsSendingVerification(false); return; }