我正在尝试让谷歌 reCAPTCHA 的新“隐形”版本在我的表单上工作。
我正在使用 https://github.com/UndefinedOffset/silverstripe-nocaptcha
根据文档,您应该能够在 config.yml 中进行更改,我认为它是不可见的?
default_size: "invisible"
——
public function HelloForm() {
$fields = new FieldList(
new TextField('Name'),
new EmailField('Email'),
new TextareaField('Message')
);
$actions = new FieldList(
new FormAction('doSubmitHelloForm', 'Submit')
);
$form = new Form($this, 'HelloForm', $fields, $actions);
$form->enableSpamProtection()
->fields()->fieldByName('Captcha')
->setTitle("Spam protection")
->setDescription("Please tick the box to prove you're a human and help us stop spam.");
return $form;
}
config.yml
NocaptchaField:
site_key: "MYKEYINHERE" #Your site key (required)
secret_key: "MYKEYINHERE" #Your secret key (required)
verify_ssl: true #Allows you to disable php-curl's SSL peer verification by setting this to false (optional, defaults to true)
default_theme: "light" #Default theme color (optional, light or dark, defaults to light)
default_type: "image" #Default captcha type (optional, image or audio, defaults to image)
default_size: "invisible" #Default size (optional, normal, compact or invisible, defaults to normal)
proxy_server: "" #Your proxy server address (optional)
proxy_auth: "" #Your proxy server authentication information (optional)
但是验证码仍在显示,我错过了什么吗? (请注意,我只是在我的本地开发机器 atm 上测试这个)。
最佳答案
好的,这里有两个问题。
:)
关于silverstripe - 如何在表单上实现新的隐形 reCAPTCHA?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43200694/