add( 'cfturnstile_error', cfturnstile_failed_message() ); } else { $nonce = wp_create_nonce( 'cfturnstile_login_check' ); } } else { $validation_error->add( 'cfturnstile_error', cfturnstile_failed_message() ); } } return $validation_error; } /* * Password Reset */ if(get_option('cfturnstile_reset')) { remove_action('lostpassword_post','cfturnstile_wp_reset_check', 10, 1); add_action('lostpassword_post','cfturnstile_wpuf_check_reset', 20); } // Function to check forms function cfturnstile_wpuf_check_reset() { if(!cfturnstile_whitelisted()) { $check = cfturnstile_check(); $success = $check['success']; if($success != true) { wp_die( '

' . esc_html__( 'ERROR:', 'simple-cloudflare-turnstile' ) . ' ' . cfturnstile_failed_message() . '

', 'simple-cloudflare-turnstile', array( 'response' => 403, 'back_link' => 1, ) ); } else { $nonce = wp_create_nonce( 'cfturnstile_login_check' ); } } } /* * Forms */ if(get_option('cfturnstile_wpuf_forms')) { add_action('wpuf_add_post_form_bottom','cfturnstile_field_wpuf_form'); add_action( 'wpuf_add_post_validate', 'cfturnstile_wpuf_check', 20 ); } // Function to check forms function cfturnstile_wpuf_check() { if(!cfturnstile_whitelisted()) { $check = cfturnstile_check(); $success = $check['success']; if($success != true) { $errors = cfturnstile_failed_message(); } } if(empty($errors)) { return; } return $errors; } // Function to add field function cfturnstile_field_wpuf_form() { ?>