From 3e51cc4fccac3465d463b7cdf6c016a25054de8a Mon Sep 17 00:00:00 2001 From: minimus7 Date: Tue, 10 Nov 2026 21:39:58 -0600 Subject: [PATCH] Sign-in page: don't promise a code when the email has a link Supabase's default sign-in email has only a link; the code appears only after the email template is changed. The page said "Sign in with a code" and "Send code" either way. It now says Send sign-in email, then: open the link in this browser, or type the code if the email has one. Co-Authored-By: Claude Opus 5.5 --- src/app/login/page.tsx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/app/login/page.tsx b/src/app/login/page.tsx index 8ecf36d..8407cfd 100644 --- a/src/app/login/page.tsx +++ b/src/app/login/page.tsx @@ -17,7 +17,7 @@ export default function LoginPage() { useEffect(() => { if (new URLSearchParams(window.location.search).get("error") === "link") { setState("error"); - setMessage("That sign-in link didn't work. Each link works once, for about an hour, in the browser you asked for it from. Send a new one."); + setMessage("That sign-in link didn't work. Each link works once, for about an hour, and only in the browser you asked for it from. Send a new email and open its link here."); } fetch("/api/setup/first-run").then((r) => r.json()).then((b: { supabase?: string; devLogin?: boolean }) => { setFirstRun(b.supabase ?? null); @@ -34,7 +34,7 @@ export default function LoginPage() { }); if (error) { setState("error"); - setMessage(/rate limit|too many/i.test(error.message) ? "Too many sign-in emails for now. Supabase's free email sends a few an hour. Wait a bit, or use the code or link from the last email." : error.message); + setMessage(/rate limit|too many/i.test(error.message) ? "Too many sign-in emails for now. Supabase's free email sends a few an hour. Wait a bit, or use the link from the last email." : error.message); } else { setSent(true); setCode(""); @@ -49,7 +49,7 @@ export default function LoginPage() { if (error) { setState("error"); setCode(""); // ready for the right one, not mixed in with the wrong one - setMessage(/expired|invalid/i.test(error.message) ? "That code didn't work. Codes work once, for about an hour. Check you typed the newest one, or send a new one." : error.message); + setMessage(/expired|invalid/i.test(error.message) ? "That code didn't work. Codes work once, for about an hour. Check you typed the newest one, or send a new email." : error.message); } else window.location.assign("/"); // a full load: the page cache may still hold "/" from before sign-in (a redirect back here) } @@ -69,10 +69,11 @@ export default function LoginPage() {
-

{sent ? `We sent a code to ${email}.` : "Sign in with a code sent to your email."}

+

{sent ? `We sent an email to ${email}.` : "Sign in with your email."}

{sent ? ( <> +

Open the sign-in link in that email, in this browser. Or, if the email has a code, type it here.

setCode(e.target.value.replace(/[^\d\s]/g, ""))} - placeholder="Code from the email" + placeholder="Code" aria-label="Code from the email" className="input w-full tabular tracking-[0.2em] text-center text-lg" /> @@ -88,9 +89,8 @@ export default function LoginPage() { {state === "checking" ? "Checking..." : "Sign in"} {state === "error" &&

{message}

} -

No code in the email? Click its sign-in link instead, in this browser.

- +
@@ -106,7 +106,7 @@ export default function LoginPage() { className="input w-full" /> {state === "error" &&

{message}

} {devLogin && (