SS4 上的垃圾邮件保护 / Recaptcha

Spamprotection / Recaptcha on SS4

我无法获取 silverstripe-recaptcha and silverstripe-spamprotection working on SS4 with silverstripe-userforms

在我的 app/_config/spamprotection.yml:

SilverStripe\SpamProtection\Extension\FormSpamProtectionExtension:
  default_spam_protector: SilverStripe\Recaptcha\RecaptchaProtector

在我的 app/_config/recaptcha.yml 中: 注意:已尝试在 api 键周围使用和不使用引号。

SilverStripe\Recaptcha\RecaptchaField:
  public_api_key: xxx
  private_api_key: xxx

我有:

控制台中没有错误/警告。

有人成功了吗? 你能看到我错过了什么吗?

问题是另一个模块正在设置 SilverStripe\SpamProtection\Extension\FormSpamProtectionExtension,覆盖了我的 app/_config/spamprotection.yml 文件中的设置。

一个解决方案是将我们的 spamprotection.yml 设置为在另一个模块的 yml 文件之后加载。我们可以通过将以下内容添加到我们的 yml 文件的顶部来完成此操作:

---
Name: app-spamprotection
After: '#galadriel'
---
SilverStripe\SpamProtection\Extension\FormSpamProtectionExtension:
  default_spam_protector: SilverStripe\Recaptcha\RecaptchaProtector

在上面的例子中galadriel是在其他模块的yml文件中设置的Name