如何在窗体上实现新的隐形reCAPTCHA?

问题描述:

我正试图获得工作在我的表单上的google reCAPTCHA的新“隐形”版本。如何在窗体上实现新的隐形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上进行测试)。

enter image description here

+0

你有没有改变配置后冲洗? –

+0

@RobbieAverill - 是的,确实。 – ifusion

+2

我不相信任何reCaptcha模块目前支持(全新!)隐形模块。不过,我会建议切换到chillu/silverstripe-recaptcha模块,因为它看起来稍微好一点,并且由SilverStripe自己的Chillu拥有。 –

好了,所以有此2个问题。

  1. 我最初使用的是早期版本的nocaptcha模块。然后我升级到0.3.0(发布时最新版本),验证码被隐藏,因为我们想要的。

  2. 模块中存在一个错误,表示它在提交表单时显示错误消息(表示需要打勾)。作者现在已经解决了这个问题,并且将很快标记为0.4.0。

:)