Download the PHP package nswdpc/silverstripe-recaptcha-v3 without Composer
On this page you can find all versions of the php package nswdpc/silverstripe-recaptcha-v3. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download nswdpc/silverstripe-recaptcha-v3
More information about nswdpc/silverstripe-recaptcha-v3
Files in nswdpc/silverstripe-recaptcha-v3
Package silverstripe-recaptcha-v3
Short Description Recaptcha V3 verification for Silverstripe framework, including a form field, spam protector and verification support
License BSD-3-Clause
Informations about the package silverstripe-recaptcha-v3
Silverstripe reCAPTCHA V3 verification
This module handles verification of the quality of website interactions using reCAPTCHA v3. It contains a form field that can be added to a form manually or added automatically via a Spam Protector configuration.
You can also use the module to verify tokens/actions from non-form interactions with your website.
The default score for verification is 0.5, you can change this in project configuration
Features
- Project-based threshold set via Configuration API
- Granular rules for protected forms
- Manage badge placement
Installation
Install via composer
Requirements
See composer.json
Form spam protection
Manually
Add the field to the form as you would any other FormField
:
Spam Protector
To set RecaptchaV3SpamProtector
as default spam protector, add the following configuration section to your project configuration
Then calling $form->enableSpamProtection()
will add the field to the form automatically. Read the silverstripe/spamprotection documentation for more information on how this works.
Field for silverstripe/userforms modules
The module nswdpc/silverstripe-recaptcha-v3-userforms
provides a userforms field
Further documentation
- Further documentation for tips on usage
- Badge placement
- Rule management
Configuration
To use the module, create a reCAPTCHA V3 site at the reCAPTCHA Admin website, once created your will be provided a site and secret key for that site both valid for the domains you add (and their subdomains).
It's a good idea to have site settings split between your environments to isolate the keys. In the reCAPTCHA site settings, add the domain(s) for the environment you are setting up along with any other desired options and Google users you share the project with.
Copy the site/secret key provided to your project configuration, e.g a spamprotection.yml
file in your project _config
directory.
Token retrieval
The behaviour triggering a token retrieval from the reCAPTCHAv3 API is a focus() event on the form. This avoids submit event race conditions with e.g frontend form validators.
Safari does not support focus event on form elements such as radios and checks. A change() event handler is used to support this.
When the first field in a form is focused, a token will be retrieved. If another field is focused in the form after the configured refresh time, the token will be refreshed.
The latest token will be submitted with the form and validated, if it has expired (tokens have a 2 minute lifetime), the visitor will be prompted to check and resubmit the form with a fresh token.
Token values are verified and give a score by the reCAPTCHAv3 API. Scores that meet the minimum threshold requirements will pass validation.
License
BSD-3-Clause
Maintainers
Bugtracker
We welcome bug reports, pull requests and feature requests on the Github Issue tracker for this project.
Please review the code of conduct prior to opening a new issue.
Security
If you have found a security issue with this module, please email digital[@]dpc.nsw.gov.au in the first instance, detailing your findings.
Development and contribution
If you would like to make contributions to the module please ensure you raise a pull request and discuss with the module maintainers.
Please review the code of conduct prior to completing a pull request.