Reputation: 614
I’m unable to get silverstripe-recaptcha and silverstripe-spamprotection working on SS4 with silverstripe-userforms.
In my app/_config/spamprotection.yml:
SilverStripe\SpamProtection\Extension\FormSpamProtectionExtension:
default_spam_protector: SilverStripe\Recaptcha\RecaptchaProtector
In my app/_config/recaptcha.yml: Note: have tried with and without quotes around the api keys.
SilverStripe\Recaptcha\RecaptchaField:
public_api_key: xxx
private_api_key: xxx
I have:
No errors / warnings in the console.
Has anybody got this working? Can you see what I’m missing?
Upvotes: 1
Views: 275
Reputation: 614
The problem was another module was setting SilverStripe\SpamProtection\Extension\FormSpamProtectionExtension
, overriding the setting in my app/_config/spamprotection.yml
file.
One solution is to set our spamprotection.yml
to load after the other module's yml file. We can do this by adding the following to the top of our yml file:
---
Name: app-spamprotection
After: '#galadriel'
---
SilverStripe\SpamProtection\Extension\FormSpamProtectionExtension:
default_spam_protector: SilverStripe\Recaptcha\RecaptchaProtector
In the above example galadriel
is the Name
set in the other module's yml file.
Upvotes: 2