Turnstile and OTS update

This commit is contained in:
Greg Kilmer
2026-07-11 18:31:58 -04:00
parent 39d775ebe1
commit 67f3fd311f
4 changed files with 18 additions and 30 deletions
+1 -11
View File
@@ -94,17 +94,7 @@ async function verifyTurnstile(token: string | undefined, ip: string): Promise<b
method: 'POST',
body: form,
});
const data = (await res.json()) as { success: boolean; 'error-codes'?: string[] };
// TEMPORARY DIAGNOSTIC: Cloudflare returns HTTP 200 even on failure, with the
// reason in error-codes (e.g. "invalid-input-secret", "invalid-input-response",
// "timeout-or-duplicate"). Log it so we can see why verification is failing.
// Remove this log once the Turnstile issue is resolved.
if (!data.success) {
console.warn('[contact] turnstile siteverify failed:', {
status: res.status,
errorCodes: data['error-codes'] ?? [],
});
}
const data = (await res.json()) as { success: boolean };
return Boolean(data.success);
} catch (err) {
// Network error talking to Cloudflare. Fail closed: reject the submission