diff --git a/friendly-captcha/modules/wordpress/wordpress_comments.php b/friendly-captcha/modules/wordpress/wordpress_comments.php
index 79e569e..3cfc002 100644
--- a/friendly-captcha/modules/wordpress/wordpress_comments.php
+++ b/friendly-captcha/modules/wordpress/wordpress_comments.php
@@ -39,15 +39,16 @@ function frcaptcha_wp_comments_validate($comment) {
return $comment;
}
- if ( empty( $_POST ) ) {
- return;
- }
-
$plugin = FriendlyCaptcha_Plugin::$instance;
if (!$plugin->is_configured() or (!$plugin->get_wp_comments_active() && !$plugin->get_wp_comments_logged_in_active())) {
return $comment;
}
+ $errorPrefix = '' . __( 'Error', 'wp-captcha' ) . ' : ';
+ if ( empty( $_POST ) ) {
+ return new WP_Error("frcaptcha-empty-error", $errorPrefix . FriendlyCaptcha_Plugin::default_error_user_message() . __(" (empty body)", "frcaptcha") );
+ }
+
// Guest user
if ($comment["user_id"] == 0 && !$plugin->get_wp_comments_active()) {
return $comment;
@@ -57,7 +58,6 @@ function frcaptcha_wp_comments_validate($comment) {
return $comment;
}
- $errorPrefix = '' . __( 'Error', 'wp-captcha' ) . ' : ';
$solution = frcaptcha_get_sanitized_frcaptcha_solution_from_post();
if (empty( $solution )) {
diff --git a/friendly-captcha/modules/wordpress/wordpress_login.php b/friendly-captcha/modules/wordpress/wordpress_login.php
index bdcbc55..736017f 100644
--- a/friendly-captcha/modules/wordpress/wordpress_login.php
+++ b/friendly-captcha/modules/wordpress/wordpress_login.php
@@ -19,17 +19,16 @@ function frcaptcha_wp_login_show_widget() {
add_filter( 'authenticate', 'frcaptcha_wp_login_validate', 20, 3 );
function frcaptcha_wp_login_validate($user, $username, $password) {
-
- if ( empty( $_POST ) ) {
- return;
- }
-
$plugin = FriendlyCaptcha_Plugin::$instance;
if (!$plugin->is_configured() or !$plugin->get_wp_login_active()) {
return $user;
}
$errorPrefix = '' . __( 'Error', 'wp-captcha' ) . ' : ';
+ if ( empty( $_POST ) ) {
+ return new WP_Error("frcaptcha-empty-error", $errorPrefix . FriendlyCaptcha_Plugin::default_error_user_message() . __(" (empty body)", "frcaptcha") );
+ }
+
$solution = frcaptcha_get_sanitized_frcaptcha_solution_from_post();
if ( empty( $solution ) ) {
diff --git a/friendly-captcha/modules/wordpress/wordpress_register.php b/friendly-captcha/modules/wordpress/wordpress_register.php
index 6e7b487..9afa0da 100644
--- a/friendly-captcha/modules/wordpress/wordpress_register.php
+++ b/friendly-captcha/modules/wordpress/wordpress_register.php
@@ -19,17 +19,16 @@ function frcaptcha_wp_register_show_widget() {
add_action( 'register_post', 'frcaptcha_wp_register_validate', 10, 3 );
function frcaptcha_wp_register_validate($user_login, $user_email, $errors) {
-
- if ( empty( $_POST ) ) {
- return;
- }
-
$plugin = FriendlyCaptcha_Plugin::$instance;
if (!$plugin->is_configured() or !$plugin->get_wp_register_active()) {
return $errors;
}
$errorPrefix = '' . __( 'Error', 'wp-captcha' ) . ' : ';
+ if ( empty( $_POST ) ) {
+ return new WP_Error("frcaptcha-empty-error", $errorPrefix . FriendlyCaptcha_Plugin::default_error_user_message() . __(" (empty body)", "frcaptcha") );
+ }
+
$solution = frcaptcha_get_sanitized_frcaptcha_solution_from_post();
if ( empty( $solution ) ) {
diff --git a/friendly-captcha/modules/wordpress/wordpress_reset_password.php b/friendly-captcha/modules/wordpress/wordpress_reset_password.php
index 0dd566d..0b21e37 100644
--- a/friendly-captcha/modules/wordpress/wordpress_reset_password.php
+++ b/friendly-captcha/modules/wordpress/wordpress_reset_password.php
@@ -19,17 +19,16 @@ function frcaptcha_wp_reset_password_show_widget() {
add_filter( 'lostpassword_post', 'frcaptcha_wp_reset_password_validate', 10, 1 );
function frcaptcha_wp_reset_password_validate($val) {
-
- if ( empty( $_POST ) ) {
- return;
- }
-
$plugin = FriendlyCaptcha_Plugin::$instance;
if (!$plugin->is_configured() or !$plugin->get_wp_reset_password_active()) {
return $val;
}
$errorPrefix = '' . __( 'Error', 'wp-captcha' ) . ' : ';
+ if ( empty( $_POST ) ) {
+ return new WP_Error("frcaptcha-empty-error", $errorPrefix . FriendlyCaptcha_Plugin::default_error_user_message() . __(" (empty body)", "frcaptcha") );
+ }
+
$solution = frcaptcha_get_sanitized_frcaptcha_solution_from_post();
if ( empty( $solution ) ) {