use of com.evolveum.midpoint.gui.api.component.captcha.CaptchaPanel in project midpoint by Evolveum.
the class PageSelfRegistration method validateCaptcha.
private boolean validateCaptcha(AjaxRequestTarget target) {
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;
}
use of com.evolveum.midpoint.gui.api.component.captcha.CaptchaPanel in project midpoint by Evolveum.
the class PageSelfRegistration method updateCaptcha.
private void updateCaptcha(AjaxRequestTarget target) {
CaptchaPanel captcha = new CaptchaPanel(ID_CAPTCHA);
captcha.setOutputMarkupId(true);
Form<?> form = (Form<?>) get(ID_MAIN_FORM);
form.addOrReplace(captcha);
target.add(form);
}
use of com.evolveum.midpoint.gui.api.component.captcha.CaptchaPanel in project midpoint by Evolveum.
the class PageSelfRegistration method initLayout.
private void initLayout() {
final Form<?> mainForm = new Form<>(ID_MAIN_FORM);
initAccessBehaviour(mainForm);
add(mainForm);
addMultilineLable(ID_WELCOME, "PageSelfRegistration.welcome.message", mainForm);
addMultilineLable(ID_ADDITIONAL_TEXT, "PageSelfRegistration.additional.message", mainForm);
initStaticFormLayout(mainForm);
initDynamicFormLayout(mainForm);
CaptchaPanel captcha = new CaptchaPanel(ID_CAPTCHA);
captcha.setOutputMarkupId(true);
mainForm.add(captcha);
AjaxSubmitButton register = new AjaxSubmitButton(ID_SUBMIT_REGISTRATION) {
private static final long serialVersionUID = 1L;
@Override
protected void onError(AjaxRequestTarget target, org.apache.wicket.markup.html.form.Form<?> form) {
showErrors(target);
}
protected void onSubmit(AjaxRequestTarget target, org.apache.wicket.markup.html.form.Form<?> form) {
submitRegistration(target);
}
};
mainForm.add(register);
MultiLineLabel label = new MultiLineLabel(ID_REGISTRATION_SUBMITED, createStringResource("PageSelfRegistration.registration.confirm.message"));
add(label);
label.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return submited;
}
@Override
public boolean isEnabled() {
return submited;
}
});
AjaxButton back = new AjaxButton(ID_BACK) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
setResponsePage(PageLogin.class);
}
};
mainForm.add(back);
}
use of com.evolveum.midpoint.gui.api.component.captcha.CaptchaPanel in project midpoint by Evolveum.
the class PageAbstractFlow method initCaptchaAndButtons.
private void initCaptchaAndButtons(WebMarkupContainer content) {
CaptchaPanel captcha = new CaptchaPanel(ID_CAPTCHA, this);
captcha.setOutputMarkupId(true);
content.add(captcha);
AjaxSubmitButton register = new AjaxSubmitButton(ID_SUBMIT_REGISTRATION, createStringResource("PageSelfRegistration.register")) {
private static final long serialVersionUID = 1L;
@Override
protected void onError(AjaxRequestTarget target) {
showErrors(target);
}
protected void onSubmit(AjaxRequestTarget target) {
doRegistration(target);
}
};
content.add(register);
AjaxButton back = new AjaxButton(ID_BACK, createStringResource("PageSelfRegistration.back")) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
setResponsePage(PageLogin.class);
}
};
back.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return isBackButtonVisible();
}
});
content.add(back);
}
use of com.evolveum.midpoint.gui.api.component.captcha.CaptchaPanel in project midpoint by Evolveum.
the class PageAbstractFlow method updateCaptcha.
protected void updateCaptcha(AjaxRequestTarget target) {
CaptchaPanel captcha = new CaptchaPanel(ID_CAPTCHA, this);
captcha.setOutputMarkupId(true);
Fragment fragment = (Fragment) get(createComponentPath(ID_MAIN_FORM, ID_CONTENT_AREA));
fragment.addOrReplace(captcha);
target.add(fragment);
}
Aggregations