Captcha not working

Hello,
I’m creating a contact form using the documentation.
However, the captcha isn’t working (not showing).

The console outputs this error:

Error: Missing required parameters in RecaptchaOptions: sitekey

However, my recaptcha_site_key is defined.
Without the captcha, the form works perfectly fine.

Here’s the full (edited) contact page’s frontmatter:

title: 'Nous contacter’
visible: true
in_nav: true
coord: "Company address"
form:
action: /contact
name: contact
fields:
-
name: name
label: 'Votre nom complet’
placeholder: 'Nom complet’
type: text
autofocus: 'on’
validate:
required: true
-
name: company
label: 'Votre société’
placeholder: Société
type: text
-
name: email
label: 'Votre adresse e-mail’
placeholder: E-mail
type: email
validate:
rule: email
required: true
-
name: phone
label: 'Votre numéro de téléphone’
placeholder: Téléphone
type: text
-
name: message
label: 'Votre message’
placeholder: Message
type: textarea
validate:
required: true
-
name: g-recaptcha-response
label: Validation
type: captcha
recaptcha_site_key: I-WROTE-THE-KEY-HERE
recaptcha_not_validated: 'Validation incorrecte.'
validate:
required: true
buttons:
-
type: submit
value: Envoyer
process:
-
captcha:
recaptcha_secret: I-WROTE-THE-OTHER-KEY-HERE
-
email:
from: '{{ form.value.email }}'
from_name: '{{ form.value.name|e }}'
to: '{{ config.plugins.email.to }}'
subject: '[Site] Message de {{ form.value.name|e }},{% if form.value.company %} ({{form.value.company|e }}){% endif %}'
body: ‘{% include ‘‘forms/data.html.twig’’ %}’
-
save:
fileprefix: contact-
dateformat: Ymd-His-u
extension: txt
body: ‘{% include ‘‘forms/data.txt.twig’’ %}’
-
message: hop!
-
display: ok

Can someone see what’s wrong?
Thanks!

Where are you setting the recpatcha_site_key? Can you paste your YAML where this is set between --- marks so it displays it as code with proper indents etc. It’s basically impossible to tell if you have an error when you paste your YAML as regular text as all the indents are lost, and they are crucial in YAML.

Actually the current version of the Form plugin has the recaptcha_site_key and recaptcha_secret with a typo.

Use recatpcha_site_key and recatpcha_secret (notice pt inverter) - I know this is a hassle, the next version will fix this (and still allow values with the typo, to avoid breaking existing working integrations)

@flaviocope: Thanks a lot! I lost so much time trying to find what was wrong, I would never have found this. It’s now working!

@rhukster: Thanks for the tip about ---, I didn’t see the indents has been removed in my message.