Skip to content

Add Turnstile protection to UK MP email form - #1045

Open
hturnbull93 wants to merge 1 commit into
mainfrom
add-turnstile-mp-email-form
Open

Add Turnstile protection to UK MP email form#1045
hturnbull93 wants to merge 1 commit into
mainfrom
add-turnstile-mp-email-form

Conversation

@hturnbull93

Copy link
Copy Markdown
Collaborator

Summary

  • The /uk-send-mp-email form POSTs JSON straight to /api/uk-send-mp-email (not a SvelteKit form action), so it was missing the honeypot + Turnstile anti-spam gate the other forms have.
  • Adds the Turnstile widget to UKMPEmailForm.svelte (shown in the confirm step, gates the send button) plus a honeypot field, and sends both to the API.
  • The API route wraps the JSON fields into a FormData shim so it can reuse the existing shared checkNotSpam verifier — same server-side check as contact-us and onboarding, no new spam logic.

Test plan

  • svelte-check: 0 errors
  • eslint: clean
  • Manual: submit form with Turnstile configured locally, confirm token required before send and confirmation email flow still works
  • Manual: confirm honeypot-filled submissions are silently dropped

🤖 Generated with Claude Code

https://claude.ai/code/session_01MfJodwSCVy9tEABpf3nfn3

This form POSTs JSON directly to /api/uk-send-mp-email rather than going
through a SvelteKit form action, so it had no anti-spam gate like the
other forms. Adds the same honeypot + Turnstile check via a FormData
shim into the shared checkNotSpam verifier.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MfJodwSCVy9tEABpf3nfn3
@netlify

netlify Bot commented Aug 14, 2026

Copy link
Copy Markdown

Deploy Preview for pauseai ready!

Name Link
🔨 Latest commit 4c562ed
🔍 Latest deploy log https://app.netlify.com/projects/pauseai/deploys/6a7f3fcd02c72a00094431cd
😎 Deploy Preview https://deploy-preview-1045--pauseai.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 61 (🔴 down 4 from production)
Accessibility: 91 (no change from production)
Best Practices: 100 (no change from production)
SEO: 82 (no change from production)
PWA: -
View the detailed breakdown and full score reports
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@hturnbull93
hturnbull93 requested a review from Wituareard August 14, 2026 16:22
@hturnbull93

Copy link
Copy Markdown
Collaborator Author

@Wituareard might as well finish off the set

@hturnbull93

Copy link
Copy Markdown
Collaborator Author
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant