Rename variables to make the ReCaptcha code easier to understand
This commit renames two variables to make it easier to understand the code responsible for adding a ReCapcha to a subscription form: formData.recaptcha -> formData.recaptchaWidgetId formData.data.recaptcha -> formData.data.recaptchaResponseToken Before this change it was harder to understand the difference between formData.recaptcha and formData.data.recaptcha since they used the same name. [MAILPOET-4145]
This commit is contained in:
@ -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,
|
||||
|
Reference in New Issue
Block a user