use of com.evolveum.midpoint.gui.api.component.captcha.CaptchaPanel in project midpoint by Evolveum.
the class PageAbstractFlow method validateCaptcha.
private boolean validateCaptcha(AjaxRequestTarget target) {
String value = System.getProperty(MidpointConfiguration.MIDPOINT_SCHRODINGER_PROPERTY);
boolean isSchrodingerTesting = Boolean.parseBoolean(value);
if (isSchrodingerTesting) {
LOGGER.trace("Skipping CAPTCHA Validation, because system variable (midpoint.schrodinget) for schrodinger testing is TRUE");
return true;
}
CaptchaPanel captcha = getCaptcha();
if (captcha.getRandomText() == null) {
String message = createStringResource("PageSelfRegistration.captcha.validation.failed").getString();
LOGGER.error(message);
getSession().error(message);
target.add(getFeedbackPanel());
updateCaptcha(target);
return false;
}
if (captcha.getCaptchaText() != null && captcha.getRandomText() != null) {
if (!captcha.getCaptchaText().equals(captcha.getRandomText())) {
String message = createStringResource("PageSelfRegistration.captcha.validation.failed").getString();
LOGGER.error(message);
getSession().error(message);
updateCaptcha(target);
target.add(getFeedbackPanel());
return false;
}
}
LOGGER.trace("CAPTCHA Validation OK");
return true;
}
Aggregations