- Issue created by @opauwlo
- last update
9 months ago 31 pass, 2 fail
The captcha_validate function in captcha.module sets a flag indicating the validity of the CAPTCHA response but does not expose this information to form field callbacks or custom validation handlers. This restricts the ability to perform certain actions based on the CAPTCHA validation status.
1. Submit a form with a CAPTCHA element.
2. Observe the inability to access the CAPTCHA validation status in form field callbacks or custom validation handlers.
Add a new key 'captcha_response_is_valid' to the $form_state array and set its value based on the result of CAPTCHA validation. This will allow form field callbacks and custom validation handlers to access the CAPTCHA validation status and perform actions accordingly.
After interaction with an Ajax field with callback, the captcha is triggered, but if the captcha fails for example the callback flow continues, with this new variable available you can check the value on the callback flow and decide what to do.
Captcha and Recpatcha have issues with the Ajax forms and field callback. For this solution, we use recaptcha_v3 and captcha with the config Persistence: Omit challenges in a multi-step/preview workflow once the user successfully responds to a challenge.
Implement the proposed solution by adding the 'captcha_response_is_valid' key to the $form_state array in the captcha_validate function.
N/A
N/A
N/A
Active
2.0
Captcha API (captcha)