• Resolved Chris Hardie

    (@chrishardie)


    hCaptcha is installed with a key configured, the site config checks out, and the captcha displays successfully on the page. But forms can still be submitted without checking the box or completing a captcha puzzle. We’ve tried this with and without the “force” setting enabled, but for the most part forms can still be submitted without any interaction with the captcha box. We’re not seeing any console/JS errors. Is there an additional setup step needed?

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor kaggdesign

    (@kaggdesign)

    With pure WooCommerce, hCaptcha works properly. On your page, you have a non-standard WC Register form, with First Name and Last Name fields added. The form is sending correctly, with hCaptcha field, but it is not verified on the backend.

    Could you temporary deactivate plugins one by one (except WC and hCaptcha ) and see when hCaptcha starts works properly? Knowing which plugin is a culprit will help to debug the case and add compatibility with that plugin.

    Thank you.

    Thread Starter Chris Hardie

    (@chrishardie)

    The name fields are custom to our theme, but we do have validation logic in place for those. And the issue is happening on the lost password page where there are no custom fields, not just the registration form, so it seems like something else is going on.

    If we need to add additional logic to our validation function to support hCaptcha, could you let me know what that should look like?

    Here’s how we call the validation function:

    add_filter( 'woocommerce_process_registration_errors', array( $this, 'wwn_validate_account_fields' ) );

    and the validation function itself is essentially:

    public function wwn_validate_account_fields( WP_Error $errors ): WP_Error {
    	if ( wp_verify_nonce( sanitize_key( $_POST['woocommerce-register-nonce'] ), 'woocommerce-register' ) ) {
    		foreach ( $this->extra_fields as $name => $field ) {
                            // perform validation
    		}
    	} else {
    		return new WP_Error( 'nonce_verification_failed', __( 'Nonce verification failed', 'our-text-domain' ) );
    	}
    	return $errors;
    }

    Thank you.

    Plugin Contributor kaggdesign

    (@kaggdesign)

    What do you return after // perform validation?

    Please refer to this filter. It should fire earlier than your filter in the theme. And it looks like your code overrides the result of the above mentioned filter.

    Could you debug the execution of these two filters and share the results?

    Plugin Contributor kaggdesign

    (@kaggdesign)

    I have fixed the issue on my end. Please install new version 4.2.1.

    Thank you for the reporting.

    Thread Starter Chris Hardie

    (@chrishardie)

    That appears to have fixed it – thank you.

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.