From 6ea18b9adcd2c0a924cf44c5ebc3d791aed883cd Mon Sep 17 00:00:00 2001 From: vnmedeiros Date: Wed, 21 Oct 2020 10:03:45 -0300 Subject: [PATCH] fix: test if recaptcha is valid response #388 --- .../api/endpoints/class-tainacan-rest-items-controller.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/classes/api/endpoints/class-tainacan-rest-items-controller.php b/src/classes/api/endpoints/class-tainacan-rest-items-controller.php index 650a0ced7..2ea3893e1 100644 --- a/src/classes/api/endpoints/class-tainacan-rest-items-controller.php +++ b/src/classes/api/endpoints/class-tainacan-rest-items-controller.php @@ -1093,8 +1093,8 @@ class REST_Items_Controller extends REST_Controller { ], 400); } $secret_key = get_option("tnc_option_recaptch_secret_key"); - $response = file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=$secret_key&response=".$captcha_data."&remoteip=".$_SERVER['REMOTE_ADDR']); - if ($response.success) { + $response = json_decode(file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=$secret_key&response=".$captcha_data."&remoteip=".$_SERVER['REMOTE_ADDR'])); + if ($response->success) { return true; } else { return new \WP_REST_Response([