4

I am trying to get the new "invisible" version of the google reCAPTCHA working on my form.

I am using the https://github.com/UndefinedOffset/silverstripe-nocaptcha

According to the docs, you should just be able to do change this in the config.yml and I assume it would be invisible?

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)

However the captcha is still showing, am I missing something? (Please note I am just testing this on my local dev machine atm).

enter image description here

ifusion
  • 2,163
  • 6
  • 24
  • 44
  • Did you flush after changing the configuration? – scrowler Apr 04 '17 at 07:18
  • @RobbieAverill - Yep sure did. – ifusion Apr 04 '17 at 07:19
  • 2
    I don't believe any reCaptcha module around currently supports the (brand new!) invisible one. I would, however, suggest to switch to the chillu/silverstripe-recaptcha module, as it seems slightly better maintained and is owned by SilverStripe's own Chillu. – Simon Erkelens Apr 04 '17 at 07:56
  • 2
    @SimonErkelens [the readme](https://github.com/UndefinedOffset/silverstripe-nocaptcha/commit/89fa4a8cf39d38c49c3d6ce402473227f98e2807) for the module in the question seems to suggest it does support "invisible" size – scrowler Apr 04 '17 at 23:30
  • 1
    I have created an issue ticket on the module. So will see what the author says. – ifusion Apr 05 '17 at 23:18

1 Answers1

1

Ok so there were 2 issues here.

  1. I was using an older version of the nocaptcha module initially. I then upgraded to 0.3.0 (Latest release at the time of posting this) and the captcha was hidden as we wanted.

  2. There was a bug in the module that meant it kept showing an error message when form was submitted (Saying the captcha needed to be ticked). The author has now fixed this and will be tagging this release soon as 0.4.0.

:)

ifusion
  • 2,163
  • 6
  • 24
  • 44