我正试图让新的"隐形"在我的表单上工作的谷歌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)
然而验证码仍在显示,我错过了什么吗? (请注意我只是在我当地的开发机器上测试它。)
答案 0 :(得分:1)
好的,这里有2个问题。
我最初使用的是旧版本的nocaptcha模块。然后我升级到0.3.0(发布此版本时的最新版本),并且我们想要隐藏验证码。
模块中有一个错误,表示在提交表单时它会一直显示错误消息(说需要勾选验证码)。作者现已修复此问题,并将很快将此版本标记为0.4.0。
:)