-
Notifications
You must be signed in to change notification settings - Fork 27
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
Add honeypot for simple spam prevention #157
base: master
Are you sure you want to change the base?
Conversation
Merge new version
@k1sul1 could you check this and merge if looks ok, thanks! |
function wplf_is_honeypot_enabled () {
// more friendly and don't repeat yourself
return apply_filters( 'wplf_honeypot', true );
}
function wplf_get_honeypot_field_name () {
return apply_filters( 'wplf_honeypot_field_name', 'send_hugs_to_developers' );
}
|
@luizbills can you explain why? Hooks are the default way WP and also WP Libre Form functionality works. I don't really see any advantages with using wrapper functions for filters.
Yeah, there are many schools of thoughts with this one. Personally, I prefer some obsecure but obiviosuly fake name and that seems to be the industry standard after doing some research. The field name can be changed with filter, to fulfill everyone's personal preferences :)
I really don't like the javascript way of doing this simple thing. Also WP Libre Form is going to have no-js fallback (#64) so doing honeypot with js, would cause a extra work with no-js fallback feature. Also future is here and we have headless chrome here, which executes javascript and can be used to send spam. Many spammers might not use that now, but it's in the future.
This can be good addition to JS side! But as said earlier, I wouldn't like to count on JS only when making spam prevention since we are going to have a no-js fallback. |
Adds a simple honeypot to detect and prevent spam. #54 related.
Honeypot we check against is simple field
<input type="checkbox" name="send_hugs_to_developers" value="1" style="display:none !important" tabindex="-1" autocomplete="off">
.This PR also introduces
spam
andspam_save
variables in submission$return
because we need a way to mark the spam and set if spam should be saved to the database. Way to mark spam can be used easily to extend spambot checks to use Akismet if developers want to do that. And spam saving is a good idea, because of possible false positives. Submissions marked as spam, are saved as trash so WP cleans up those after 30 days.All of these features can be turned off via hooks. For example, if a site gets loads of spammy submissions, it's wise not to save those.