Silverstripe SS4上的Spamprotection/Recaptcha
我无法获取和使用SS4 在我的应用程序/_config/spamprotection.yml中:Silverstripe SS4上的Spamprotection/Recaptcha,silverstripe,silverstripe-4,Silverstripe,Silverstripe 4,我无法获取和使用SS4 在我的应用程序/_config/spamprotection.yml中: SilverStripe\SpamProtection\Extension\FormSpamProtectionExtension: default_spam_protector: SilverStripe\Recaptcha\RecaptchaProtector 在我的应用程序/_config/recaptcha.yml中: 注意:您尝试过使用和不使用api键的引号 SilverStripe
SilverStripe\SpamProtection\Extension\FormSpamProtectionExtension:
default_spam_protector: SilverStripe\Recaptcha\RecaptchaProtector
在我的应用程序/_config/recaptcha.yml中:
注意:您尝试过使用和不使用api键的引号
SilverStripe\Recaptcha\RecaptchaField:
public_api_key: xxx
private_api_key: xxx
我有:
- 完成了开发/构建和刷新
- 在我的用户表单中添加了反垃圾邮件字段
你能看到我遗漏了什么吗?问题是另一个模块正在设置
SilverStripe\SpamProtection\Extension\FormSpamProtectionExtension
,覆盖我的app/\u 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
。我已经在本地进行了测试,它对我有效。SilverStripe 4、recaptcha模块、垃圾邮件保护模块、用户表单模块。spamprotection.yml和recaptcha.yml,如上所述。简单的用户表单,包含两个字段和一个垃圾邮件保护字段。这对我来说很有用。也许在其他地方的另一个配置中,SilverStripe\SpamProtection\Extension\FormSpamProtectionExtension
正在被覆盖。检查所有app/_config/
yml文件,查看FormSpamProtectionExtension
是否在其他地方被重新定义。或者,用户表单页面中的字段可能尚未发布。请尝试再次发布页面,并检查后端的字段列表中是否仍显示垃圾邮件字段。该字段已被其他模块覆盖。谢谢你的建议。