Say why a sign-in link didn't work, and clear rejected sign-ins
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
de40f85407
commit
9c4bf6198e
4 files changed
+11
-2
No files matched your search
@@ -8,6 +8,7 @@ export async function GET(request: Request) {
|
||||
const supabase = await createClient();
|
||||
const { error } = await supabase.auth.exchangeCodeForSession(code);
|
||||
if (!error) return home(origin);
|
||||
console.error("[broke] sign-in link:", error.message);
|
||||
}
|
||||
return NextResponse.redirect(`${origin}/login?error=link`);
|
||||
}
|
||||
|
||||
@@ -11,6 +11,10 @@ export default function LoginPage() {
|
||||
const [firstRun, setFirstRun] = useState<string | null>(null);
|
||||
const [devLogin, setDevLogin] = useState(false);
|
||||
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.");
|
||||
}
|
||||
fetch("/api/setup/first-run").then((r) => r.json()).then((b: { supabase?: string; devLogin?: boolean }) => {
|
||||
setFirstRun(b.supabase ?? null);
|
||||
setDevLogin(!!b.devLogin);
|
||||
|
||||
Reference in new issue
Block a user