Example usage for org.apache.wicket.extensions.validation.validator RfcCompliantEmailAddressValidator getInstance

List of usage examples for org.apache.wicket.extensions.validation.validator RfcCompliantEmailAddressValidator getInstance

Introduction

In this page you can find the example usage for org.apache.wicket.extensions.validation.validator RfcCompliantEmailAddressValidator getInstance.

Prototype

public static RfcCompliantEmailAddressValidator getInstance() 

Source Link

Usage

From source file:com.evolveum.midpoint.web.page.forgetpassword.PageForgotPassword.java

License:Apache License

private void initStaticLayout(Form<?> mainForm) {
    WebMarkupContainer staticLayout = new WebMarkupContainer(ID_STATIC_LAYOUT);
    staticLayout.setOutputMarkupId(true);
    mainForm.add(staticLayout);//from   w  ww.  j a  v a2  s . com

    staticLayout.add(new VisibleEnableBehaviour() {

        private static final long serialVersionUID = 1L;

        @Override
        public boolean isVisible() {
            return !isDynamicForm();
        }
    });

    WebMarkupContainer userNameContainer = new WebMarkupContainer(ID_USERNAME_CONTAINER);
    userNameContainer.setOutputMarkupId(true);
    staticLayout.add(userNameContainer);

    RequiredTextField<String> userName = new RequiredTextField<>(ID_USERNAME, new Model<>());
    userName.setOutputMarkupId(true);
    userNameContainer.add(userName);
    userNameContainer.add(new VisibleEnableBehaviour() {

        private static final long serialVersionUID = 1L;

        public boolean isVisible() {
            return getResetPasswordPolicy().getResetMethod() == ResetMethod.SECURITY_QUESTIONS;
        };
    });

    WebMarkupContainer emailContainer = new WebMarkupContainer(ID_EMAIL_CONTAINER);
    emailContainer.setOutputMarkupId(true);
    staticLayout.add(emailContainer);
    RequiredTextField<String> email = new RequiredTextField<>(ID_EMAIL, new Model<>());
    email.add(RfcCompliantEmailAddressValidator.getInstance());
    email.setOutputMarkupId(true);
    emailContainer.add(email);
    emailContainer.add(new VisibleEnableBehaviour() {

        private static final long serialVersionUID = 1L;

        public boolean isVisible() {
            ResetMethod resetMethod = getResetPasswordPolicy().getResetMethod();
            return resetMethod == ResetMethod.SECURITY_QUESTIONS || resetMethod == ResetMethod.MAIL;
        };
    });

}

From source file:de.inren.frontend.user.EditOrCreateUserPanel.java

License:Apache License

@Override
protected void initGui() {

    Form<User> form = new Form<User>("form", new CompoundPropertyModel<User>(user));

    StringResourceModel lEmail = new StringResourceModel("email.label", EditOrCreateUserPanel.this, null);
    form.add(new Label("email.label", lEmail));
    form.add(new TextField<String>("email", String.class).setRequired(true).setLabel(lEmail)
            .add(RfcCompliantEmailAddressValidator.getInstance()));

    StringResourceModel lPwd = new StringResourceModel("password.label", EditOrCreateUserPanel.this, null);
    form.add(new Label("password.label", lPwd));
    PasswordTextField password = new PasswordTextField("password");
    password.setModel(passwordModel);/*from  ww  w.  j a  v  a 2 s. com*/
    password.setRequired(false).setLabel(lPwd);
    form.add(password);

    StringResourceModel lPwdrep = new StringResourceModel("passwordrepeat.label", EditOrCreateUserPanel.this,
            null);
    form.add(new Label("passwordrepeat.label", lPwdrep));
    PasswordTextField passwordrepeat = new PasswordTextField("passwordrepeat");
    passwordrepeat.setModel(password.getModel());
    passwordrepeat.setRequired(false).setLabel(lPwdrep);
    form.add(passwordrepeat);

    form.add(new EqualPasswordInputValidator(password, passwordrepeat));

    StringResourceModel lFname = new StringResourceModel("firstname.label", EditOrCreateUserPanel.this, null);
    form.add(new Label("firstname.label", lFname));
    form.add(new TextField<String>("firstname", String.class).setRequired(true).setLabel(lFname));

    StringResourceModel lLname = new StringResourceModel("lastname.label", EditOrCreateUserPanel.this, null);
    form.add(new Label("lastname.label", lLname));
    form.add(new TextField<String>("lastname", String.class).setRequired(true).setLabel(lLname));

    // TODO die Boolean Werte
    StringResourceModel lLaccountNonExpired = new StringResourceModel("accountNonExpired.label",
            EditOrCreateUserPanel.this, null);
    form.add(new Label("accountNonExpired.label", lLaccountNonExpired));
    form.add(new CheckBox("accountNonExpired").setLabel(lLaccountNonExpired));

    StringResourceModel laccountNonLocked = new StringResourceModel("accountNonLocked.label",
            EditOrCreateUserPanel.this, null);
    form.add(new Label("accountNonLocked.label", laccountNonLocked));
    form.add(new CheckBox("accountNonLocked").setLabel(laccountNonLocked));

    StringResourceModel lLcredentialsNonExpired = new StringResourceModel("credentialsNonExpired.label",
            EditOrCreateUserPanel.this, null);
    form.add(new Label("credentialsNonExpired.label", lLcredentialsNonExpired));
    form.add(new CheckBox("credentialsNonExpired").setLabel(lLcredentialsNonExpired));

    List<Role> allRoles = new ArrayList<Role>();
    try {
        allRoles = roleService.loadAllRoles();
    } catch (RuntimeException e1) {
        e1.printStackTrace();
    }
    StringResourceModel lRoles = new StringResourceModel("roles.label", EditOrCreateUserPanel.this, null);
    form.add(new Label("roles.label", lRoles));

    form.add(new Palette<Role>("roles", new ListModel<Role>(allRoles), new ChoiceRenderer<Role>("name", "id"),
            5, false));

    form.add(new AjaxLink<Void>("cancel") {
        @Override
        public void onClick(AjaxRequestTarget target) {
            getSession().getFeedbackMessages().clear();
            delegate.switchToComponent(target, delegate.getManagePanel());
        }
    });

    form.add(new AjaxButton("submit") {
        @Override
        protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
            try {
                String password = passwordModel.getObject();
                if (!"".equals(password)) {
                    ((User) form.getDefaultModelObject()).setPassword(password);
                }
                User u = userService.save((User) form.getModelObject());
                form.info(new StringResourceModel("feedback.success", EditOrCreateUserPanel.this, null)
                        .getString());
                delegate.switchToComponent(target, delegate.getManagePanel());
            } catch (RuntimeException e) {
                form.error(new StringResourceModel("TODO", EditOrCreateUserPanel.this, null).getString());
                target.add(getFeedback());
            }
        }

        @Override
        protected void onError(AjaxRequestTarget target, Form<?> form) {
            FeedbackPanel f = getFeedback();
            if (target != null && f != null) {
                target.add(f);
            }
        }
    });

    add(form);
}

From source file:it.av.eatt.web.page.SignUpPanel.java

License:Apache License

/**
 * Constructor/* ww  w  . j  a  v  a  2 s .c  om*/
 * 
 * @param id
 * @param feedbackPanel
 * @param userService
 * @throws JackWicketException
 */
public SignUpPanel(String id, FeedbackPanel feedbackPanel, EaterService userService,
        CountryService countryService) throws JackWicketException {
    super(id);
    this.userService = userService;
    this.feedbackPanel = feedbackPanel;

    RfcCompliantEmailAddressValidator emailAddressValidator = RfcCompliantEmailAddressValidator.getInstance();
    StringValidator pwdValidator = StringValidator.LengthBetweenValidator.lengthBetween(6, 20);

    Eater user = new Eater();
    signUpForm = new Form<Eater>("signUpForm", new CompoundPropertyModel<Eater>(user));

    signUpForm.setOutputMarkupId(true);
    signUpForm.add(new RequiredTextField<String>(Eater.FIRSTNAME));
    signUpForm.add(new RequiredTextField<String>(Eater.LASTNAME));
    signUpForm.add(new RequiredTextField<String>(Eater.EMAIL).add(emailAddressValidator));
    List<Country> countriyList = countryService.getAll();
    Country userCountry = null;
    for (Country country : countriyList) {
        if (country.getIso3().equals(getRequest().getLocale().getISO3Country())) {
            userCountry = country;
        }
    }
    DropDownChoice<Country> country = new DropDownChoice<Country>(Eater.COUNTRY, countryService.getAll());
    // country.setDefaultModelObject(userCountry);
    signUpForm.add(country);
    signUpForm.add(new DropDownChoice<Language>("language", languageService.getAll(), new LanguageRenderer())
            .setRequired(true));
    PasswordTextField pwd1 = new PasswordTextField(Eater.PASSWORD);
    pwd1.add(pwdValidator);
    signUpForm.add(pwd1);
    PasswordTextField pwd2 = new PasswordTextField("password-confirm", new Model(passwordConfirm));
    signUpForm.add(pwd2);
    EqualPasswordInputValidator passwordInputValidator = new EqualPasswordInputValidator(pwd1, pwd2);
    signUpForm.add(passwordInputValidator);
    SubmitButton submitButton = new SubmitButton("buttonCreateNewAccount", signUpForm);
    signUpForm.add(submitButton);
    signUpForm.setDefaultButton(submitButton);

    goSignInAfterSignUp = new Link<String>("goSignInAfterSignUp") {
        private static final long serialVersionUID = 1L;

        @Override
        public void onClick() {
            setResponsePage(SignIn.class);
        }
    };
    goSignInAfterSignUp.setOutputMarkupId(true);
    goSignInAfterSignUp.setVisible(false);
    add(goSignInAfterSignUp);

    signUpForm.add(captcha = new KittenCaptchaPanel("captcha", new Dimension(400, 200)));
    add(signUpForm);
}

From source file:it.av.es.web.SignUpPanel.java

License:Apache License

/**
 * Constructor//from  w  w w  . jav  a  2s.  c o m
 * 
 * @param id
 * @param feedbackPanel
 * @throws EasySendException
 */
public SignUpPanel(String id, FeedbackPanel feedbackPanel) throws EasySendException {
    super(id);
    this.feedbackPanel = feedbackPanel;
    Injector.get().inject(this);

    RfcCompliantEmailAddressValidator emailAddressValidator = RfcCompliantEmailAddressValidator.getInstance();
    StringValidator pwdValidator = StringValidator.lengthBetween(6, 20);
    EmailPresentValidator emailPresentValidator = new EmailPresentValidator();

    User user = new User();
    user.setLanguage(languageService.getSupportedLanguage(getLocale()));

    signUpForm = new Form<User>("signUpForm", new CompoundPropertyModel<User>(user));

    signUpForm.setOutputMarkupId(true);
    signUpForm.add(new RequiredTextField<String>(User.FIRSTNAME));
    signUpForm.add(new RequiredTextField<String>(User.LASTNAME));
    signUpForm.add(
            new RequiredTextField<String>(User.EMAIL).add(emailAddressValidator).add(emailPresentValidator));

    signUpForm.add(new DropDownChoice<Language>("language", languageService.getAll(), new LanguageRenderer())
            .setRequired(true));
    PasswordTextField pwd1 = new PasswordTextField(User.PASSWORD);
    pwd1.add(pwdValidator);
    signUpForm.add(pwd1);
    PasswordTextField pwd2 = new PasswordTextField("password-confirm", new Model<String>(passwordConfirm));
    signUpForm.add(pwd2);
    EqualPasswordInputValidator passwordInputValidator = new EqualPasswordInputValidator(pwd1, pwd2);
    signUpForm.add(passwordInputValidator);
    SubmitButton submitButton = new SubmitButton("buttonCreateNewAccount", signUpForm);
    submitButton.setOutputMarkupId(true);
    add(submitButton);
    signUpForm.setDefaultButton(submitButton);
    goSignInAfterSignUp = new Link<String>("goSignInAfterSignUp") {
        private static final long serialVersionUID = 1L;

        @Override
        public void onClick() {
            setResponsePage(SignIn.class);
        }
    };
    goSignInAfterSignUp.setOutputMarkupId(true);
    goSignInAfterSignUp.setOutputMarkupPlaceholderTag(true);
    goSignInAfterSignUp.setVisible(false);
    add(goSignInAfterSignUp);
    add(signUpForm);
}

From source file:it.av.youeat.web.panel.SignUpPanel.java

License:Apache License

/**
 * Constructor//from   w w  w.  j  av a2 s.  c om
 * 
 * @param id
 * @param feedbackPanel
 * @param eaterService
 * @throws YoueatException
 */
public SignUpPanel(String id, FeedbackPanel feedbackPanel) throws YoueatException {
    super(id);
    Injector.get().inject(this);
    this.feedbackPanel = feedbackPanel;

    List<Country> countryList = countryService.getAll();
    Country userCountry = null;
    for (Country country : countryList) {
        if (country.getIso3().equals(getRequest().getLocale().getISO3Country())) {
            userCountry = country;
        }
    }
    RfcCompliantEmailAddressValidator emailAddressValidator = RfcCompliantEmailAddressValidator.getInstance();
    StringValidator pwdValidator = StringValidator.LengthBetweenValidator.lengthBetween(6, 20);
    EmailPresentValidator emailPresentValidator = new EmailPresentValidator();

    Eater user = new Eater();
    user.setCountry(userCountry);
    user.setLanguage(languageService.getSupportedLanguage(getLocale()));

    signUpForm = new Form<Eater>("signUpForm", new CompoundPropertyModel<Eater>(user));

    signUpForm.setOutputMarkupId(true);
    signUpForm.add(new RequiredTextField<String>(Eater.FIRSTNAME));
    signUpForm.add(new RequiredTextField<String>(Eater.LASTNAME));
    signUpForm.add(
            new RequiredTextField<String>(Eater.EMAIL).add(emailAddressValidator).add(emailPresentValidator));

    DropDownChoice<Country> country = new DropDownChoice<Country>(Eater.COUNTRY, countryService.getAll(),
            new CountryRenderer());
    country.setRequired(true);
    signUpForm.add(country);
    signUpForm.add(new DropDownChoice<Language>("language", languageService.getAll(), new LanguageRenderer())
            .setRequired(true));
    PasswordTextField pwd1 = new PasswordTextField(Eater.PASSWORD);
    pwd1.add(pwdValidator);
    signUpForm.add(pwd1);
    PasswordTextField pwd2 = new PasswordTextField("password-confirm", new Model<String>(passwordConfirm));
    signUpForm.add(pwd2);
    EqualPasswordInputValidator passwordInputValidator = new EqualPasswordInputValidator(pwd1, pwd2);
    signUpForm.add(passwordInputValidator);
    SubmitButton submitButton = new SubmitButton("buttonCreateNewAccount", signUpForm);
    submitButton.setOutputMarkupId(true);
    add(submitButton);
    signUpForm.setDefaultButton(submitButton);
    DropDownChoice<Sex> sexField = new DropDownChoice<Sex>("sex", Arrays.asList(Sex.values()));
    sexField.setRequired(true);
    signUpForm.add(sexField);
    goSignInAfterSignUp = new Link<String>("goSignInAfterSignUp") {
        private static final long serialVersionUID = 1L;

        @Override
        public void onClick() {
            setResponsePage(SignIn.class);
        }
    };
    goSignInAfterSignUp.setOutputMarkupId(true);
    goSignInAfterSignUp.setOutputMarkupPlaceholderTag(true);
    goSignInAfterSignUp.setVisible(false);
    add(goSignInAfterSignUp);
    KittenCaptchaPanel captcha = new KittenCaptchaPanel("captcha", new Dimension(400, 200));
    signUpForm.add(captcha);
    // used to show error message
    final HiddenField<String> captchaHidden = new HiddenField<String>("captchaHidden", new Model());
    signUpForm.add(captchaHidden);
    signUpForm.add(new KittenCaptchaValidator(captchaHidden, captcha));
    add(signUpForm);
}

From source file:org.apache.openmeetings.util.mail.MailUtil.java

License:Apache License

public static boolean isValid(String email) {
    if (Strings.isEmpty(email)) {
        return false;
    }//from www .  jav a2 s  .  c o  m
    Validatable<String> eml = new Validatable<>(email);
    RfcCompliantEmailAddressValidator.getInstance().validate(eml);
    return eml.isValid();
}

From source file:org.apache.openmeetings.web.common.GeneralUserForm.java

License:Apache License

public GeneralUserForm(String id, IModel<User> model, boolean isAdminForm) {
    super(id, model);

    //TODO should throw exception if non admin User edit somebody else (or make all fields read-only)
    add(passwordField = new PasswordTextField("password", new Model<String>()));
    ConfigurationDao cfgDao = getBean(ConfigurationDao.class);
    passwordField.setRequired(false).add(minimumLength(getMinPasswdLength(cfgDao)));

    updateModelObject(getModelObject(), isAdminForm);
    add(new DropDownChoice<Salutation>("salutation", Arrays.asList(Salutation.values()),
            new ChoiceRenderer<Salutation>() {
                private static final long serialVersionUID = 1L;

                @Override// w  w w  .  j  a v a 2  s .  co m
                public Object getDisplayValue(Salutation object) {
                    return getString("user.salutation." + object.name());
                }

                @Override
                public String getIdValue(Salutation object, int index) {
                    return object.name();
                }
            }));
    add(new TextField<String>("firstname"));
    add(new TextField<String>("lastname"));

    add(new DropDownChoice<String>("timeZoneId", AVAILABLE_TIMEZONES));

    add(new LanguageDropDown("languageId"));

    add(email = new RequiredTextField<String>("address.email"));
    email.setLabel(Model.of(Application.getString(137)));
    email.add(RfcCompliantEmailAddressValidator.getInstance());
    add(new TextField<String>("address.phone"));
    add(new CheckBox("sendSMS"));
    add(new AjaxDatePicker("age", new PropertyModel<LocalDate>(this, "age"), WebSession.get().getLocale()) {
        private static final long serialVersionUID = 1L;

        @Override
        public void onValueChanged(IPartialPageRequestHandler target) {
            User u = GeneralUserForm.this.getModelObject();
            u.setAge(CalendarHelper.getDate(age, u.getTimeZoneId()));
        }
    });
    add(new TextField<String>("address.street"));
    add(new TextField<String>("address.additionalname"));
    add(new TextField<String>("address.zip"));
    add(new TextField<String>("address.town"));
    add(new CountryDropDown("address.country"));
    add(new TextArea<String>("address.comment"));

    add(new Select2MultiChoice<GroupUser>("groupUsers", null, new ChoiceProvider<GroupUser>() {
        private static final long serialVersionUID = 1L;

        @Override
        public String getDisplayValue(GroupUser choice) {
            return choice.getGroup().getName();
        }

        @Override
        public String getIdValue(GroupUser choice) {
            Long id = choice.getGroup().getId();
            return id == null ? null : "" + id;
        }

        @Override
        public void query(String term, int page, Response<GroupUser> response) {
            for (GroupUser ou : grpUsers) {
                if (Strings.isEmpty(term) || ou.getGroup().getName().contains(term)) {
                    response.add(ou);
                }
            }
        }

        @Override
        public Collection<GroupUser> toChoices(Collection<String> _ids) {
            List<Long> ids = new ArrayList<Long>();
            for (String id : _ids) {
                ids.add(Long.parseLong(id));
            }
            List<GroupUser> list = new ArrayList<GroupUser>();
            User u = GeneralUserForm.this.getModelObject();
            for (Group g : getBean(GroupDao.class).get(ids)) {
                GroupUser gu = new GroupUser(g, u);
                int idx = grpUsers.indexOf(gu);
                list.add(idx < 0 ? gu : grpUsers.get(idx));
            }
            return list;
        }
    }).setEnabled(isAdminForm));
}

From source file:org.apache.openmeetings.web.room.NicknameDialog.java

License:Apache License

@Override
protected void onInitialize() {
    getTitle().setObject(getString("1287"));
    ok = new DialogButton("ok", getString("54"));
    form.add(feedback);/*  ww w. j  a  v  a2s.c  o m*/
    form.add(new RequiredTextField<String>("firstname").setLabel(new ResourceModel("135"))
            .add(minimumLength(getMinFnameLength())));
    form.add(new RequiredTextField<String>("lastname").setLabel(new ResourceModel("136"))
            .add(minimumLength(getMinLnameLength())));
    form.add(new RequiredTextField<String>("address.email").setLabel(new ResourceModel("119"))
            .add(RfcCompliantEmailAddressValidator.getInstance()));
    super.onInitialize();
}

From source file:org.apache.openmeetings.web.util.UserChoiceProvider.java

License:Apache License

public static User getUser(String value) {
    User u = null;//from w  ww.  j  av  a  2s  .c om
    if (!Strings.isEmpty(value)) {
        //FIXME refactor this
        String email = null;
        String fName = null;
        String lName = null;
        int idx = value.indexOf('<');
        if (idx > -1) {
            int idx1 = value.indexOf('>', idx);
            if (idx1 > -1) {
                email = value.substring(idx + 1, idx1);

                String name = value.substring(0, idx).replace("\"", "");
                int idx2 = name.indexOf(' ');
                if (idx2 > -1) {
                    fName = name.substring(0, idx2);
                    lName = name.substring(idx2 + 1);
                } else {
                    fName = "";
                    lName = name;
                }

            }
        } else {
            email = value;
        }
        Validatable<String> valEmail = new Validatable<String>(email);
        RfcCompliantEmailAddressValidator.getInstance().validate(valEmail);
        if (valEmail.isValid()) {
            u = getBean(UserDao.class).getContact(email, fName, lName, getUserId());
        }
    }
    return u;
}

From source file:org.hippoecm.frontend.plugins.cms.admin.users.CreateUserPanel.java

License:Apache License

public CreateUserPanel(final String id, final IBreadCrumbModel breadCrumbModel, final IPluginContext context,
        final IPluginConfig config) {
    super(id, breadCrumbModel);
    setOutputMarkupId(true);/* w ww .  ja  va2s .  c  o m*/

    passwordValidationService = context.getService(IPasswordValidationService.class.getName(),
            IPasswordValidationService.class);

    defaultUserSecurityProviderName = config.getString(ListUsersPlugin.DEFAULT_USER_SECURITY_PROVIDER_KEY);

    // add form with markup id setter so it can be updated via ajax
    final User user = new User();
    final IModel<User> userModel = new CompoundPropertyModel<>(user);
    final Form<User> form = new HippoForm<User>("form", userModel) {

        @Override
        protected void onValidateModelObjects() {
            if (password != null && passwordValidationService != null) {
                try {
                    final List<PasswordValidationStatus> statuses = passwordValidationService
                            .checkPassword(password, user);
                    for (final PasswordValidationStatus status : statuses) {
                        if (!status.accepted()) {
                            error(status.getMessage());
                        }
                    }
                } catch (RepositoryException e) {
                    log.error("Failed to validate password using password validation service", e);
                }
            }
        }

        @Override
        protected void onError() {
            password = null;
            passwordCheck = null;
        }
    };
    form.setOutputMarkupId(true);
    add(form);

    final RequiredTextField<String> usernameField = new RequiredTextField<>("username");
    usernameField.add(StringValidator.minimumLength(2));
    usernameField.add(new UsernameValidator());
    form.add(usernameField);

    final TextField<String> firstNameField = new TextField<>("firstName");
    form.add(firstNameField);

    final TextField<String> lastNameField = new TextField<>("lastName");
    form.add(lastNameField);

    final TextField<String> emailField = new TextField<>("email");
    emailField.add(RfcCompliantEmailAddressValidator.getInstance());
    emailField.setRequired(false);
    form.add(emailField);

    final PasswordTextField passwordField = new PasswordTextField("password",
            new PropertyModel<>(this, "password"));
    passwordField.setResetPassword(false);
    form.add(passwordField);

    final PasswordTextField passwordCheckField = new PasswordTextField("password-check",
            new PropertyModel<>(this, "passwordCheck"));
    passwordCheckField.setRequired(false);
    passwordCheckField.setResetPassword(false);
    form.add(passwordCheckField);

    form.add(new EqualPasswordInputValidator(passwordField, passwordCheckField));

    form.add(new AjaxButton("create-button", form) {

        @Override
        protected void onSubmit(AjaxRequestTarget target, Form form) {

            final String username = user.getUsername();
            try {
                user.create(defaultUserSecurityProviderName);
                user.savePassword(password);

                EventBusUtils.post("create-user", HippoEventConstants.CATEGORY_USER_MANAGEMENT,
                        "created user " + username);

                final String infoMsg = getString("user-created", new Model<>(user));
                activateParentAndDisplayInfo(infoMsg);
            } catch (RepositoryException e) {
                target.add(CreateUserPanel.this);
                error(getString("user-create-failed", new Model<>(user)));
                log.error("Unable to create user '{}' : ", username, e);
            }
        }

        @Override
        protected void onError(AjaxRequestTarget target, Form form) {
            // make sure the feedback panel is shown
            target.add(CreateUserPanel.this);
        }
    });

    // add a button that can be used to submit the form via ajax
    form.add(new AjaxButton("cancel-button") {
        @Override
        protected void onSubmit(AjaxRequestTarget target, Form form) {
            activateParent();
        }
    }.setDefaultFormProcessing(false));
}