fix: add Cloudflare Turnstile spam protection to contact form#201
Merged
ManukMinasyan merged 2 commits intomainfrom Mar 31, 2026
Merged
fix: add Cloudflare Turnstile spam protection to contact form#201ManukMinasyan merged 2 commits intomainfrom
ManukMinasyan merged 2 commits intomainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Integrates Cloudflare Turnstile into the contact form flow to reduce bot spam while keeping the existing honeypot layer.
Changes:
- Added Turnstile widget rendering to the contact form and validation to
ContactRequest - Included Turnstile scripts in the guest layout and added related service/env configuration
- Added feature tests covering success and failure cases for Turnstile validation
Reviewed changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/Feature/ContactFormTest.php | Adds feature tests for Turnstile-protected contact submissions |
| resources/views/layouts/guest.blade.php | Loads Turnstile scripts via Blade component |
| resources/views/contact.blade.php | Renders the Turnstile widget and shows validation errors |
| config/services.php | Adds Turnstile keys to app configuration |
| composer.json | Adds the Turnstile Laravel package dependency |
| app/Http/Requests/ContactRequest.php | Enforces Turnstile validation on contact submissions |
| .env.example | Documents required env vars for Turnstile configuration |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ryangjchandler/laravel-cloudflare-turnstile) to block bot spam on the contact formContactRequestconfig/services.phpSetup
After merging, create a Turnstile widget in the Cloudflare dashboard (Managed mode recommended) and add the keys to production
.env:Test plan