From 72b478686cb4cf48820972bd05e91dded9531611 Mon Sep 17 00:00:00 2001 From: David Dada Date: Sun, 21 Jun 2026 22:17:41 +0100 Subject: [PATCH] =?UTF-8?q?fix(email):=20attach=20Turnstile=20token=20to?= =?UTF-8?q?=20email=E2=86=92address=20lookup=20(organizer/will-call)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit /api/identity/lookup-email enforces Turnstile, but both callers — the organizer email check-in (EventManageScreen) and the door will-call lookup (DoorScreen) — POSTed { email } with no token, so the lookup would 403 with "Bot check failed" the same way the wallet OTP send did (#107). Acquire getTurnstileToken() before each fetch and include it in the body. Co-Authored-By: Claude Opus 4.8 (1M context) --- web/components/screens/DoorScreen.tsx | 4 +++- web/components/screens/EventManageScreen.tsx | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/web/components/screens/DoorScreen.tsx b/web/components/screens/DoorScreen.tsx index 627531b..0c3fa90 100644 --- a/web/components/screens/DoorScreen.tsx +++ b/web/components/screens/DoorScreen.tsx @@ -9,6 +9,7 @@ import { EMAIL_ENABLED, ENOKI_ENABLED, PACKAGE_ID, TICKET_TYPE } from "@/lib/con import { useAllEvents } from "@/lib/events"; import { checkInTx, getFields } from "@/lib/ticketing"; import { humanizeError } from "@/lib/moveErrors"; +import { getTurnstileToken } from "@/lib/turnstileClient"; import { clearStaffKeypair, extractTicketId, @@ -498,10 +499,11 @@ function AdmitPanel({ eventId, onAdmitted }: { eventId: string; onAdmitted: () = if (!em) return; setLookupBusy(true); try { + const turnstileToken = await getTurnstileToken(); const r = await fetch("/api/identity/lookup-email", { method: "POST", headers: { "Content-Type": "application/json" }, - body: JSON.stringify({ email: em }), + body: JSON.stringify({ email: em, turnstileToken }), }); const j = (await r.json()) as { address?: string | null; error?: string }; if (!r.ok) throw new Error(j.error || "Lookup failed"); diff --git a/web/components/screens/EventManageScreen.tsx b/web/components/screens/EventManageScreen.tsx index f2d75ad..c907ce7 100644 --- a/web/components/screens/EventManageScreen.tsx +++ b/web/components/screens/EventManageScreen.tsx @@ -55,6 +55,7 @@ import { EV_EMAIL_GRANT_CREATED } from "@/lib/identity"; import { createSessionKey } from "@/lib/seal"; import { useSignPersonalMessage, decryptAttendeeEmail } from "@/lib/emailBinding"; import type { ProfileEnvelope } from "@/lib/profile"; +import { getTurnstileToken } from "@/lib/turnstileClient"; import { useAllEvents } from "@/lib/events"; import { useEventMarkets } from "@/lib/markets"; import { @@ -822,10 +823,11 @@ function OrganizerEmailCheckinCard({ ctx }: { ctx: DeckCtx }) { if (!em) return; setBusy(true); try { + const turnstileToken = await getTurnstileToken(); const r = await fetch("/api/identity/lookup-email", { method: "POST", headers: { "Content-Type": "application/json" }, - body: JSON.stringify({ email: em }), + body: JSON.stringify({ email: em, turnstileToken }), }); const j = (await r.json()) as { address?: string | null; error?: string }; if (!r.ok) throw new Error(j.error || "Lookup failed");