diff --git a/src/components/portal/login-flow.tsx b/src/components/portal/login-flow.tsx index d037880..8c23119 100644 --- a/src/components/portal/login-flow.tsx +++ b/src/components/portal/login-flow.tsx @@ -454,7 +454,14 @@ function OtpVerify({ account, email, initialChannel = "email", remember, setReme if (!PHONE_RE.test(phone)) { setError("Enter your phone in international format, e.g. +14155550100."); return; } await sendPhoneOtp(phone); setSent(true); } - } catch (e) { setError((e as Error).message); } + } catch (e) { + // gotrue can throw an error whose message is an unhelpful "{}"/JSON blob (e.g. a + // 500 "Error sending magic link email" when SMTP isn't set up). Show something + // readable and actionable instead of the raw payload. + const raw = (e as { message?: unknown })?.message; + const readable = typeof raw === "string" && raw.trim() && !raw.trim().startsWith("{") ? raw.trim() : ""; + setError(readable || "We couldn't send your sign-in code right now. Please try again shortly, or sign in with your password."); + } } async function complete(code: string) {