innoweb / silverstripe-spamprotection-honeypot
Provides invisible honeypot spam protection for Silverstripe CMS.
Installs: 1 432
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Type:silverstripe-vendormodule
Requires
Requires (Dev)
- phpunit/phpunit: ~9.5
README
Overview
Provides invisible honeypot spam protection for Silverstripe CMS.
Creates form fields hidden from users that invalidate submission if the contained data has been tampered with. Also invalidates submissions that respond too quickly.
Requirements
- Silverstripe Framework 5
- Silverstripe SpamProtection 4.
Note: this version is compatible with Silverstripe 5. For Silverstripe 4, please see the 1 release line.
Installation
Run the following to add this module as a requirement and install it via composer.
$ composer require innoweb/silverstripe-spamprotection-honeypot
Then run dev/build.
Usage
Create a configuration file spamprotection.yml
in app/_config
with the following configuration:
--- Name: app-spamprotection --- SilverStripe\SpamProtection\Extension\FormSpamProtectionExtension: default_spam_protector: Innoweb\SpamProtectionHoneypot\SpamProtector\HoneypotSpamProtector
We also recommend changing the default field name from Captcha
to something less obvious:
SilverStripe\SpamProtection\Extension\FormSpamProtectionExtension: field_name: 'AdditionalInformation'
Then enable spam protection on your form by calling Form::enableSpamProtection()
.
public function ExampleForm() { $form = new ExampleForm($this, 'Example'); $form->enableSpamProtection(); return $form; }
You can change the amount time that is checked to see if the response is made too quickly with the following configuration.
Innoweb\SpamProtectionHoneypot\FormField\HoneypotField: time_limit: 12
This example changes the time to 12 seconds. The default is set to 8 seconds.
You can also change the default text used in the value field, overriding the translation using your lang file (e.g. app/lang/en.yml
):
en: Innoweb\SpamProtectionHoneypot\FormField\HoneypotField: DefaultValue: 'Some text that should not be touched.'
This defaults to 'Please leave this as is.'
.
Contributing
Please see contributing for details.
Credits
Thanks to studiobonito/silverstripe-spamprotection-honeypot and symbiote-library/silverstripe-spamprotection-honeypot for the inspirations.
License
BSD 3-Clause License, see License