diff --git a/mailpoet/assets/js/src/public.jsx b/mailpoet/assets/js/src/public.jsx
index 2e8a37bdec..bc29359856 100644
--- a/mailpoet/assets/js/src/public.jsx
+++ b/mailpoet/assets/js/src/public.jsx
@@ -106,8 +106,8 @@ jQuery(($) => {
}
})
.done((response) => {
- if (window.grecaptcha && formData.recaptcha) {
- window.grecaptcha.reset(formData.recaptcha);
+ if (window.grecaptcha && formData.recaptchaWidgetId) {
+ window.grecaptcha.reset(formData.recaptchaWidgetId);
}
return response;
})
@@ -129,8 +129,8 @@ jQuery(($) => {
// reset validation
parsley.reset();
// reset captcha
- if (window.grecaptcha && formData.recaptcha) {
- window.grecaptcha.reset(formData.recaptcha);
+ if (window.grecaptcha && formData.recaptchaWidgetId) {
+ window.grecaptcha.reset(formData.recaptchaWidgetId);
}
// resize iframe
@@ -171,9 +171,11 @@ jQuery(($) => {
const params = { sitekey, size };
if (size === 'invisible') {
- params.callback = function invisibleReCaptchaCallback(token) {
+ params.callback = function invisibleReCaptchaCallback(
+ recaptchaResponseToken,
+ ) {
const formData = form.mailpoetSerializeObject() || {};
- formData.data.recaptcha = token;
+ formData.data.recaptchaResponseToken = recaptchaResponseToken;
submitSubscribeForm(form, formData, form.parsley());
};
@@ -398,7 +400,7 @@ jQuery(($) => {
const formData = form.mailpoetSerializeObject() || {};
const size = form.find('.mailpoet_recaptcha').attr('data-size');
- if (window.grecaptcha && formData.recaptcha) {
+ if (window.grecaptcha && formData.recaptchaWidgetId) {
// The API for the invisible and checkbox ReCaptchas is slightly different. For the
// former, we need to call execute() and then the ReCaptcha API calls the callback set
// inside renderCaptcha() with a token if the captcha was solved successfully. The
@@ -408,9 +410,8 @@ jQuery(($) => {
if (size === 'invisible') {
window.grecaptcha.execute();
} else {
- formData.data.recaptcha = window.grecaptcha.getResponse(
- formData.recaptcha,
- );
+ formData.data.recaptchaResponseToken =
+ window.grecaptcha.getResponse(formData.recaptchaWidgetId);
}
}
diff --git a/mailpoet/lib/Form/Renderer.php b/mailpoet/lib/Form/Renderer.php
index d5d3a9fa3c..97ae115b16 100644
--- a/mailpoet/lib/Form/Renderer.php
+++ b/mailpoet/lib/Form/Renderer.php
@@ -113,7 +113,7 @@ class Renderer {
-
+
';
return $html;
diff --git a/mailpoet/lib/Subscribers/SubscriberSubscribeController.php b/mailpoet/lib/Subscribers/SubscriberSubscribeController.php
index 8ff8f3ef95..aed98c75ab 100644
--- a/mailpoet/lib/Subscribers/SubscriberSubscribeController.php
+++ b/mailpoet/lib/Subscribers/SubscriberSubscribeController.php
@@ -216,7 +216,7 @@ class SubscriberSubscribeController {
}
}
- if (Captcha::isReCaptcha($captchaSettings['type']) && empty($data['recaptcha'])) {
+ if (Captcha::isReCaptcha($captchaSettings['type']) && empty($data['recaptchaResponseToken'])) {
return ['error' => __('Please check the CAPTCHA.', 'mailpoet')];
}
@@ -227,7 +227,7 @@ class SubscriberSubscribeController {
$secretToken = $captchaSettings['recaptcha_secret_token'];
}
- $response = empty($data['recaptcha']) ? $data['recaptcha-no-js'] : $data['recaptcha'];
+ $response = empty($data['recaptchaResponseToken']) ? $data['recaptcha-no-js'] : $data['recaptchaResponseToken'];
$response = $this->wp->wpRemotePost('https://www.google.com/recaptcha/api/siteverify', [
'body' => [
'secret' => $secretToken,