2017-04-04 58 views
3

我正試圖獲得工作在我的表單上的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擁有。 –

回答

1

好了,所以有此2個問題。

  1. 我最初使用的是早期版本的nocaptcha模塊。然後我升級到0.3.0(發佈時最新版本),驗證碼被隱藏,因爲我們想要的。

  2. 模塊中存在一個錯誤,表示它在提交表單時顯示錯誤消息(表示需要打勾)。作者現在已經解決了這個問題,並且將很快標記爲0.4.0。

:)

相關問題