Expand my Community achievements bar.

SOLVED

How to listen to reCaptchav2 server validation failed event?

Avatar

Level 3

Any expert knows?

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

https://experienceleague.adobe.com/docs/experience-manager-65/forms/adaptive-forms-basic-authoring/c...

 

See this example : 

if (slingRequest.getParameter("numericbox1614079614831").length() >= 5) {
GuideCaptchaValidatorProvider apiProvider = sling.getService(GuideCaptchaValidatorProvider.class);
String formPath = slingRequest.getResource().getPath();
String captchaData = slingRequest.getParameter(GuideConstants.GUIDE_CAPTCHA_DATA);
if (!apiProvider.validateCAPTCHA(formPath, captchaData).isCaptchaValid()){
response.setStatus(400);
return;
}
}

View solution in original post

1 Reply

Avatar

Correct answer by
Community Advisor

https://experienceleague.adobe.com/docs/experience-manager-65/forms/adaptive-forms-basic-authoring/c...

 

See this example : 

if (slingRequest.getParameter("numericbox1614079614831").length() >= 5) {
GuideCaptchaValidatorProvider apiProvider = sling.getService(GuideCaptchaValidatorProvider.class);
String formPath = slingRequest.getResource().getPath();
String captchaData = slingRequest.getParameter(GuideConstants.GUIDE_CAPTCHA_DATA);
if (!apiProvider.validateCAPTCHA(formPath, captchaData).isCaptchaValid()){
response.setStatus(400);
return;
}
}