How to implement a new invisible reCAPTCHA on a form?

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

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

As per the docs, you should just change this value in config.yml and I assume it will 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 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 still shows, am I missing something? (Note that I am just testing this on my local dev machine).

enter image description here

+3


source to share


1 answer


So there were 2 questions here.

  • I used an earlier version of the nocaptcha module. I then upgraded to 0.3 (the latest release at the time this post was posted) and the envelope was hidden as we wanted.

  • An error occurred in the module, which meant that it continued to show an error message when submitting the form (that it should be checked). The author has now fixed this and will soon mark this release as 0.4.0.



:)

+1


source







All Articles