Skip to content

Conversation

@avicndugu
Copy link
Contributor

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

@raviriley
Copy link
Owner

raviriley commented May 14, 2025

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

@avicndugu
Copy link
Contributor Author

I've cleaned up the whitespace in the diff.
I can't figure out how to clear the diff on some two lines so I'll leave it at that.

@raviriley raviriley requested a review from Copilot June 11, 2025 07:34
Copy link
Contributor

Copilot AI left a 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

Copy link
Owner

@raviriley raviriley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks @avicndugu !

@raviriley raviriley merged commit d477a17 into raviriley:master Jun 20, 2025
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.

2 participants