fix recaptcha validation
This commit is contained in:
@ -103,7 +103,13 @@ class Subscribers extends APIEndpoint {
|
|||||||
'response' => $data['recaptcha']
|
'response' => $data['recaptcha']
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
if(is_wp_error($res) || !$res['body']['success']) {
|
if(is_wp_error($res)) {
|
||||||
|
return $this->badRequest(array(
|
||||||
|
APIError::BAD_REQUEST => __('Error while validating the reCAPTCHA.', 'mailpoet')
|
||||||
|
));
|
||||||
|
}
|
||||||
|
$res = json_decode($res['body']);
|
||||||
|
if(!$res->success) {
|
||||||
return $this->badRequest(array(
|
return $this->badRequest(array(
|
||||||
APIError::BAD_REQUEST => __('Error while validating the reCAPTCHA.', 'mailpoet')
|
APIError::BAD_REQUEST => __('Error while validating the reCAPTCHA.', 'mailpoet')
|
||||||
));
|
));
|
||||||
|
Reference in New Issue
Block a user