-
-
Notifications
You must be signed in to change notification settings - Fork 777
Stopping basic spam bots from filling contact form #80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Sorry for the delayed response here, any chance you could clean up the whitespace in the diff @avicndugu (thus reducing the diff to only the needed lines changed) Thank you for taking the time to implement this! I appreciate you |
|
I've cleaned up the whitespace in the diff. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a honeypot field to a static contact form to prevent basic spam bots from submitting the form.
- Adds a hidden username field in the HTML form as a honeypot
- Introduces a check in the JavaScript to only submit the form if the hidden field remains empty
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| assets/js/contact_me.js | Implements a honeypot check to avoid submitting spam bot requests. |
| _includes/contact.html | Adds a hidden username input field in the contact form. |
Comments suppressed due to low confidence (1)
assets/js/contact_me.js:26
- [nitpick] The comment contains a typo ('Disable's') and could be clearer; consider updating it to explain that the form only submits when the honeypot field is empty.
if(username === ''){ // Disable's form submit if hidden input(username) has been filled
raviriley
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks @avicndugu !
This is an enhancement or feature.
Summary
With this new feature, a hidden form field stops spambots from filling and submitting your contact form without using third-party services.
This will not stop human spammers and sophisticated spam bots.
Context
To stop spammers, many sites use Google reCAPTCHA and other similar services. These services use a private key that requires a backend(server or serverless function). This solution is for static websites that don't have a backend solution.
This is related to Github Issue #19