Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

It is possible to enable reCaptcha (Google reCaptcha v3) on your forms out of the box. All you have to do is add the enable_recaptcha: true parameter to your form, and add {% include_plate_scripts "recaptcha_scripts" %} somewhere on the page that has the form on it. The form will not be submitted if the scripts are not included on the page! You will receive the JS error executeRecaptcha is not defined if you don't. Read more about the include tag.

The form then imports Google's reCaptcha JS API. When the form is submitted, a token is generated and sent with the form to the Plate backend. Before the message is sent, the captcha will be verified by the Plate servers.

...

As you can see theexecuteRecaptcha function receives two arguments: the form's DOM object and a callback function, that submits the form after the token is generated, so it can be sent with the form to the Plate backend.

executeRecaptcha accepts a form, usually created with the form tag, so you can submit it. It is also possible to only retreive the recaptcha token, if you want even more flexibilty. This can be done with loadRecaptcha.

Code Block
loadRecaptcha('custom-unique-recaptcha-form-action', function(token){
  console.log(token) // returns the recaptcha token in the callback
})

Filter by label (Content by label)
showLabelsfalse
max5
spacescom.atlassian.confluence.content.render.xhtml.model.resource.identifiers.SpaceResourceIdentifier@201a3b
sortmodified
showSpacefalse
reversetrue
typepage
cqllabel in ( "recaptcha" , "spamfilter" , "spam" , "forms" ) and type = "page" and space = "DOCS"
labelsrecaptcha spam forms spamfilter