Fixed turnstile

This commit is contained in:
2026-10-15 15:27:43 +02:00
parent 7ef7927e38
commit 3bab8a0697
58 changed files with 1182 additions and 322 deletions
+2 -1
View File
@@ -14,7 +14,7 @@ import { validateSubmission } from './validateSubmission.js';
* which goes out over the configured email adapter (mailAdapter). Storing the submission is enough.
*
* server-only: touches the Turnstile secret.
*/ export async function submitForm({ consentFieldName, data, formId, ip, maxPerMinute = 5, payload, turnstileToken }) {
*/ export async function submitForm({ consentFieldName, data, formId, ip, maxPerMinute = 5, payload, turnstileOnConfigError = 'allow', turnstileToken }) {
// 1. Rate limit — cheapest gate, drops a flood before any real work.
if (maxPerMinute > 0 && ip) {
if (!checkRateLimit({
@@ -31,6 +31,7 @@ import { validateSubmission } from './validateSubmission.js';
if (turnstileToken !== undefined) {
const ok = await verifyTurnstile({
ip,
onConfigError: turnstileOnConfigError,
payload,
token: turnstileToken
});