diff --git a/friendly-captcha/friendly-captcha.php b/friendly-captcha/friendly-captcha.php index 1d6c6e8..ad3f365 100644 --- a/friendly-captcha/friendly-captcha.php +++ b/friendly-captcha/friendly-captcha.php @@ -3,7 +3,7 @@ /** * Plugin Name: Friendly Captcha for WordPress * Description: Protect WordPress website forms from spam and abuse with Friendly Captcha, a privacy-first anti-bot solution. - * Version: 1.15.3 + * Version: 1.15.4 * Requires at least: 5.0 * Requires PHP: 7.3 * Author: Friendly Captcha GmbH @@ -19,7 +19,7 @@ die; } -define('FRIENDLY_CAPTCHA_VERSION', '1.15.3'); +define('FRIENDLY_CAPTCHA_VERSION', '1.15.4'); define('FRIENDLY_CAPTCHA_FRIENDLY_CHALLENGE_VERSION', '0.9.18'); define('FRIENDLY_CAPTCHA_FRIENDLY_CAPTCHA_SDK_VERSION', '0.1.8'); define('FRIENDLY_CAPTCHA_SUPPORTED_LANGUAGES', [ diff --git a/friendly-captcha/includes/helpers.php b/friendly-captcha/includes/helpers.php index fb8c16e..2b88be0 100644 --- a/friendly-captcha/includes/helpers.php +++ b/friendly-captcha/includes/helpers.php @@ -14,6 +14,18 @@ function frcaptcha_log_remote_request($url, $response) trigger_error($log); } +function frcaptcha_log_unsuccessful_verification($request, $response) +{ + $log = sprintf( + /* translators: 1: request, 2: response */ + __('Friendly Captcha verification unsuccessful. This can usually be ignored and is only logged for debugging purposes. Request: %1$s Response: %2$s', 'frcaptcha'), + json_encode($request), + json_encode($response) + ); + + trigger_error($log); +} + function frcaptcha_v2_log_verify_response($url, $status, $errorCode) { $log = sprintf( diff --git a/friendly-captcha/includes/verification.php b/friendly-captcha/includes/verification.php index 3f534c5..98237ee 100644 --- a/friendly-captcha/includes/verification.php +++ b/friendly-captcha/includes/verification.php @@ -64,6 +64,10 @@ function frcaptcha_v1_verify_captcha_solution($solution, $sitekey, $api_key) ? $response_body['errors'] : array(); + // Useful for debugging with customers + if (!$success && WP_DEBUG) { + frcaptcha_log_unsuccessful_verification($request_body, $response_body); + } return array( "success" => $success, @@ -107,6 +111,11 @@ function frcaptcha_v2_verify_captcha_solution($solution, $sitekey, $api_key) ); } + // Useful for debugging with customers + if (!$result->shouldAccept() && WP_DEBUG) { + frcaptcha_log_unsuccessful_verification($solution, $result->response); + } + $errorCodes = $result->getErrorCode() ? [$result->getErrorCode()] : []; return array( "success" => $result->shouldAccept(), diff --git a/friendly-captcha/readme.txt b/friendly-captcha/readme.txt index ebf84ca..730071f 100644 --- a/friendly-captcha/readme.txt +++ b/friendly-captcha/readme.txt @@ -4,7 +4,7 @@ Tags: captcha, antispam, spam, contact form, recaptcha, friendly-captcha, block Requires at least: 5.0 Tested up to: 6.5 Requires PHP: 7.3 -Stable tag: 1.15.3 +Stable tag: 1.15.4 License: GPL v2 or later License URI: https://www.gnu.org/licenses/gpl-2.0.html @@ -96,6 +96,10 @@ However, you may wish to email the authors of plugins you'd like to support Frie == Changelog == += 1.15.4 = + +* Log failed verification requests when WP_DEBUG is enabled + = 1.15.3 = * Remove incorrect plugin detection for Divi integration