From 265894f90488e4515961931e4cbb0b40697ca09b Mon Sep 17 00:00:00 2001
From: Bevan Stanely <60595515+bevsxyz@users.noreply.github.com>
Date: Thu, 22 Jul 2021 02:21:00 +0530
Subject: [PATCH] feat: add support for rCAPTCHA in Formspree forms (#2377)
---
.../layouts/partials/widgets/contact.html | 32 ++++++++++++-------
1 file changed, 20 insertions(+), 12 deletions(-)
diff --git a/wowchemy/layouts/partials/widgets/contact.html b/wowchemy/layouts/partials/widgets/contact.html
index cc5cb2bd..49144e7f 100644
--- a/wowchemy/layouts/partials/widgets/contact.html
+++ b/wowchemy/layouts/partials/widgets/contact.html
@@ -11,9 +11,14 @@
{{ $use_form := or $use_netlify_form $use_formspree_form }}
{{ $use_netlify_captcha := $st.Params.content.form.netlify.captcha | default true }}
+{{ $use_formspree_captcha := $st.Params.content.form.formspree.captcha | default false }}
{{ $columns := $st.Params.design.columns | default "2" }}
+{{ if and $use_formspree_form $use_formspree_captcha }}
+
+{{ end }}
+
{{ with $st.Content }}{{ . }}{{ end }}
@@ -24,14 +29,16 @@
{{ $post_action = "netlify" }}
{{ else if $use_formspree_form }}
{{ if not $st.Params.content.form.formspree.id }}
- {{ errorf "You have chosen to use Formspree as the provider for the contact form. Please set your Formspree Form ID in the Contact widget or disable the form." }}
- {{ errorf "Documentation: https://wowchemy.com/docs/page-builder/#contact" }}
+ {{ errorf "You have chosen to use Formspree as the provider for the contact form. Please set your Formspree Form ID in the Contact widget or disable the form.\nDocumentation: https://wowchemy.com/docs/widget/contact/" }}
+ {{ end }}
+ {{ if and $use_formspree_captcha (not $st.Params.content.form.formspree.captcha_key) }}
+ {{ errorf "You have chosen to use reCAPTCHA for Formspree. Please set your Formspree CAPTCHA KEY in the Contact widget or disable reCAPTCHA.\nDocumentation: https://help.formspree.io/hc/en-us/articles/360022811154" }}
{{ end }}
{{ $post_action = printf "action=\"https://formspree.io/f/%s\"" $st.Params.content.form.formspree.id }}
- {{end}}
+ {{ end }}
- {{end}}
+ {{ end }}