2017-04-04 4 views
3

私のフォーム上で動作しているGoogleのreCAPTCHAの新しい「見えない」バージョンを取得しようとしています。私は、ドキュメントによるとhttps://github.com/UndefinedOffset/silverstripe-nocaptchaフォームに新しい非表示reCAPTCHAを実装する方法は?

を使用しています

、あなただけの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) 

、私は何かが足りないのですか? (私は自分のローカルのdevマシンatmでこれをテストしていることに注意してください)。

enter image description here

+0

は、設定を変更した後、あなたはフラッシュましたか? –

+0

@RobbieAverill - どうかしました。 – ifusion

+2

私はreCaptchaモジュールが現在(真新しい!)不可視のものをサポートしているとは思わない。私は、しかし、それは少し良い維持らしいとSilverStripe自身Chilluが所有しているとして、chillu/silverstripe-reCAPTCHAのモジュールに切り替えることをお勧めします。 –

答えて

1

[OK]をので、ここで2つの問題がありました。

  1. 私は古いバージョンのnocaptchaモジュールを使用していました。私は0.3.0にアップグレードしました(これを掲示した時点で最新のリリース)、キャプチャは私たちが望むように隠されていました。

  2. それは(チェックが入っするために必要なキャプチャを言って)フォームが提出されたときに、エラーメッセージを示したまま意味モジュールにバグがありました。著者はこれを修正し、すぐに0.4.0とタグ付けする予定です。

:)

関連する問題