Search in sources :

Example 6 with MultiLineLabel

use of org.apache.wicket.markup.html.basic.MultiLineLabel in project midpoint by Evolveum.

the class PageSelfRegistration method submitRegistration.

@Override
protected void submitRegistration(AjaxRequestTarget target) {
    OperationResult result = new OperationResult(OPERATION_SAVE_USER);
    saveUser(result);
    result.computeStatus();
    if (result.getStatus() == OperationResultStatus.SUCCESS) {
        getSession().success(createStringResource("PageSelfRegistration.registration.success").getString());
        String sequenceName = getSelfRegistrationConfiguration().getAdditionalAuthentication();
        if (SecurityUtils.getSequenceByName(sequenceName, getSelfRegistrationConfiguration().getAuthenticationPolicy()) != null) {
            target.add(PageSelfRegistration.this);
        } else {
            switch(getSelfRegistrationConfiguration().getAuthenticationMethod()) {
                case MAIL:
                    target.add(PageSelfRegistration.this);
                    break;
                case SMS:
                    throw new UnsupportedOperationException();
                case NONE:
                    setResponsePage(PageLogin.class);
            }
        }
        LOGGER.trace("Registration for user {} was successfull.", getUserModel().getObject());
    } else {
        String message;
        if (result.getUserFriendlyMessage() != null) {
            message = WebModelServiceUtils.translateMessage(result, this);
        } else {
            message = result.getMessage();
        }
        getSession().error(createStringResource("PageSelfRegistration.registration.error", message).getString());
        // removePassword(target);
        updateCaptcha(target);
        target.add(getFeedbackPanel());
        LOGGER.error("Failed to register user {}. Reason {}", getUserModel().getObject(), result.getMessage());
        return;
    }
    target.add(getFeedbackPanel());
    MultiLineLabel label = new MultiLineLabel(ID_REGISTRATION_SUBMITED, createStringResource("PageSelfRegistration.registration.confirm.message"));
    Fragment messageContent = new Fragment("contentArea", "messageContent", this);
    messageContent.add(label);
    getMainForm().replace(messageContent);
    target.add(this);
}
Also used : OperationResult(com.evolveum.midpoint.schema.result.OperationResult) Fragment(org.apache.wicket.markup.html.panel.Fragment) MultiLineLabel(org.apache.wicket.markup.html.basic.MultiLineLabel)

Example 7 with MultiLineLabel

use of org.apache.wicket.markup.html.basic.MultiLineLabel in project midpoint by Evolveum.

the class PageEmailNonse method initCustomLayer.

protected void initCustomLayer() {
    MidpointForm form = new MidpointForm(ID_MAIN_FORM);
    form.add(new VisibleEnableBehaviour() {

        private static final long serialVersionUID = 1L;

        @Override
        public boolean isVisible() {
            return !submited;
        }
    });
    add(form);
    initStaticLayout(form);
    initDynamicLayout(form, PageEmailNonse.this);
    initButtons(form);
    MultiLineLabel label = new MultiLineLabel(ID_PASSWORD_RESET_SUBMITED, createStringResource("PageForgotPassword.form.submited.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;
        }
    });
}
Also used : MidpointForm(com.evolveum.midpoint.web.component.form.MidpointForm) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour) MultiLineLabel(org.apache.wicket.markup.html.basic.MultiLineLabel)

Aggregations

MultiLineLabel (org.apache.wicket.markup.html.basic.MultiLineLabel)7 VisibleEnableBehaviour (com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)4 AjaxButton (com.evolveum.midpoint.web.component.AjaxButton)2 AjaxSubmitButton (com.evolveum.midpoint.web.component.AjaxSubmitButton)2 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)2 CaptchaPanel (com.evolveum.midpoint.gui.api.component.captcha.CaptchaPanel)1 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)1 Form (com.evolveum.midpoint.web.component.form.Form)1 MidpointForm (com.evolveum.midpoint.web.component.form.MidpointForm)1 ComponentTag (org.apache.wicket.markup.ComponentTag)1 MarkupStream (org.apache.wicket.markup.MarkupStream)1 Fragment (org.apache.wicket.markup.html.panel.Fragment)1