Hi,
Sounds like a good idea! We need to test if that’s possible. But if it is we’ll definitely do it like that 👍
Hi, thanks for the quick reply!
I think a solution could be to replace
add_filter( 'wp_authenticate_user', 'advanced_google_recaptcha_process_login_form', 10, 2 );
with
add_filter( 'authenticate', 'advanced_google_recaptcha_process_login_form', 10, 3 );
and the “advanced_google_recaptcha_process_login_form” function should be something like this:
function advanced_google_recaptcha_process_login_form( $user, $username, $password ) {
if ( 'POST' === $_SERVER['REQUEST_METHOD']
&& ( ! isset( $_POST['g-recaptcha-response'] ) || true !== advanced_google_recaptcha_validate_posted_captcha() ) )
{
remove_all_filters( 'authenticate' ); //Remove any further authentication filters of WP, WordFence, etc.
return new WP_Error( 'reCAPTCHA', '<strong>' . esc_html__( 'ERROR:', 'advanced-google-recaptcha' ) . '</strong> ' . esc_html__( 'Google reCAPTCHA verification failed.', 'advanced-google-recaptcha' ) );
}
}
——-
Also I think all these checks:
if ( 'POST' === $_SERVER['REQUEST_METHOD'] && isset( $_POST['g-recaptcha-response'] ) ) {
if ( true !== advanced_google_recaptcha_validate_posted_captcha() ) {
//Duplicated errors
}
} else {
//Duplicated errors
}
can be simplified as
if ( 'POST' === $_SERVER['REQUEST_METHOD']
&& ( ! isset( $_POST['g-recaptcha-response'] ) || true !== advanced_google_recaptcha_validate_posted_captcha() )
{
//One error
}
-
This reply was modified 2 years, 10 months ago by
frzsombor.
-
This reply was modified 2 years, 10 months ago by
frzsombor.
-
This reply was modified 2 years, 10 months ago by
frzsombor.
Hi,
Thanks for taking the time to write that! 🙂
We are working on the new update which has some other fixes and changes as well so it will be released soon.