handling multiple instances of reCaptcha
This commit is contained in:
@ -90,13 +90,13 @@ class Subscribers extends APIEndpoint {
|
||||
));
|
||||
}
|
||||
|
||||
if(!empty($recaptcha['enabled']) && $recaptcha['enabled'] && !isset($data['recaptcha'])) {
|
||||
if(!empty($recaptcha['enabled']) && !isset($data['recaptcha'])) {
|
||||
return $this->badRequest(array(
|
||||
APIError::BAD_REQUEST => __('Please check the captcha.', 'mailpoet')
|
||||
));
|
||||
}
|
||||
|
||||
if(!empty($recaptcha['enabled']) && $recaptcha['enabled']) {
|
||||
if(!empty($recaptcha['enabled'])) {
|
||||
$res = wp_remote_post('https://www.google.com/recaptcha/api/siteverify', array(
|
||||
'body' => array(
|
||||
'secret' => $recaptcha['secret_token'],
|
||||
@ -109,7 +109,7 @@ class Subscribers extends APIEndpoint {
|
||||
));
|
||||
}
|
||||
$res = json_decode(wp_remote_retrieve_body($res));
|
||||
if(empty($res) || !$res->success) {
|
||||
if(empty($res->success)) {
|
||||
return $this->badRequest(array(
|
||||
APIError::BAD_REQUEST => __('Error while validating the captcha.', 'mailpoet')
|
||||
));
|
||||
|
Reference in New Issue
Block a user