当前位置: 首页>>代码示例>>Java>>正文


Java EqualPasswordInputValidator类代码示例

本文整理汇总了Java中org.apache.wicket.markup.html.form.validation.EqualPasswordInputValidator的典型用法代码示例。如果您正苦于以下问题:Java EqualPasswordInputValidator类的具体用法?Java EqualPasswordInputValidator怎么用?Java EqualPasswordInputValidator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


EqualPasswordInputValidator类属于org.apache.wicket.markup.html.form.validation包,在下文中一共展示了EqualPasswordInputValidator类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createBody

import org.apache.wicket.markup.html.form.validation.EqualPasswordInputValidator; //导入依赖的package包/类
@Override
protected Component createBody(String wicketId) {
	DelegatedMarkupPanel body = new DelegatedMarkupPanel(wicketId, UserPasswordUpdatePopup.class);
	
	passwordForm = new Form<Void>("form");
	TextField<String> newPasswordField = new PasswordTextField("newPassword", newPasswordModel);
	TextField<String> confirmPasswordField = new PasswordTextField("confirmPassword", Model.of(""));
	
	body.add(
			passwordForm
					.add(
							newPasswordField
									.setLabel(new ResourceModel("business.user.newPassword"))
									.setRequired(true)
									.add(
											new UserPasswordValidator(typeDescriptor)
													.userModel(getModel())
									),
							
							new CoreLabel("passwordHelp",
									new ResourceModel(
											typeDescriptor.securityTypeDescriptor().resourceKeyGenerator().resourceKey("password.help"),
											new ResourceModel(UserTypeDescriptor.USER.securityTypeDescriptor().resourceKeyGenerator().resourceKey("password.help"))
									)
							),
							
							confirmPasswordField
									.setLabel(new ResourceModel("business.user.confirmPassword"))
									.setRequired(true)
					)
					.add(new EqualPasswordInputValidator(newPasswordField, confirmPasswordField))
	);
	
	return body;
}
 
开发者ID:openwide-java,项目名称:owsi-core-parent,代码行数:36,代码来源:UserPasswordUpdatePopup.java

示例2: createBody

import org.apache.wicket.markup.html.form.validation.EqualPasswordInputValidator; //导入依赖的package包/类
@Override
protected Component createBody(String wicketId) {
	DelegatedMarkupPanel body = new DelegatedMarkupPanel(wicketId, getClass());
	
	userForm = new Form<Void>("form");
	
	body.add(
			userForm
					.add(createStandardUserFields("fields"))
					.add(new EqualPasswordInputValidator(passwordField, confirmPasswordField))
	);
	
	return body;
}
 
开发者ID:openwide-java,项目名称:owsi-core-parent,代码行数:15,代码来源:UserPopup.java

示例3: ChangePasswordPanel

import org.apache.wicket.markup.html.form.validation.EqualPasswordInputValidator; //导入依赖的package包/类
public ChangePasswordPanel(String id) {
    super(id);

    add(new FeedbackPanel("feedback"));
    
    final UIUserCheckPassword user = new UIUserCheckPassword();

    user.setUsername(getCurrentUserName());

    final Form<UIUserCheckPassword> form = new Form<UIUserCheckPassword>("form",
            new Model<UIUserCheckPassword>(user)) {
               @Override
                public void onSubmit() {
                    userService.changeTempPassword(user.getUsername(), user.getPassword());
                    onPasswordChanged();
                }
    };

    add(form);

    FormComponent<String> password1Field = new PasswordTextField(
            "password", new PropertyModel<String>(user, "password"))
            .setRequired(true);
    form.add(password1Field);

    FormComponent<String> password2Field = new PasswordTextField(
            "password2", new PropertyModel<String>(user, "password2"))
            .setRequired(true);
    form.add(password2Field);

    form.add(new EqualPasswordInputValidator(password1Field,
                    password2Field));
    form.add(new PasswordInputValidator(getCurrentUserName(), password1Field, userService));

    Button submitButton = new Button("change");
    submitButton.setOutputMarkupId(true);
    submitButton.setMarkupId("change-button");
    form.add(submitButton);
}
 
开发者ID:payneteasy,项目名称:superfly,代码行数:40,代码来源:ChangePasswordPanel.java

示例4: onConfigure

import org.apache.wicket.markup.html.form.validation.EqualPasswordInputValidator; //导入依赖的package包/类
@Override
protected void onConfigure() {
    super.onConfigure();

    FormComponent fc1 = (FormComponent) get(ID_INPUT);
    FormComponent fc2 = (FormComponent) get(ID_INPUT_2);

    Form form = findParent(Form.class);
    form.add(new EqualPasswordInputValidator(fc2, fc1));
}
 
开发者ID:Evolveum,项目名称:gizmo-v3,代码行数:11,代码来源:PasswordInput.java

示例5: UserDetailsPanel

import org.apache.wicket.markup.html.form.validation.EqualPasswordInputValidator; //导入依赖的package包/类
public <T extends AbstractAttributableTO> UserDetailsPanel(
        final String id,
        final UserTO userTO,
        final Form form,
        final boolean resetPassword,
        final boolean templateMode) {

    super(id);

    // ------------------------
    // Username
    // ------------------------
    final FieldPanel username = new AjaxTextFieldPanel(
            "username", "username",
            new PropertyModel<String>(userTO, "username"), true);
    if (!templateMode) {
        username.addRequiredLabel();
    }
    add(username);
    // ------------------------

    // ------------------------
    // Password
    // ------------------------
    final FieldPanel password;
    final Label confirmPasswordLabel = new Label("confirmPasswordLabel",
            new ResourceModel("confirmPassword"));
    final FieldPanel confirmPassword;
    if (templateMode) {
        password = new AjaxTextFieldPanel("password", "password",
                new PropertyModel<String>(userTO, "password"), true);

        confirmPasswordLabel.setVisible(false);
        confirmPassword = new AjaxTextFieldPanel("confirmPassword",
                "confirmPassword", new Model<String>(), false);
        confirmPassword.setEnabled(false);
        confirmPassword.setVisible(false);
    } else {
        password = new AjaxPasswordFieldPanel("password", "password",
                new PropertyModel<String>(userTO, "password"), true);
        password.setRequired(userTO.getId() == 0);
        ((PasswordTextField) password.getField()).setResetPassword(
                resetPassword);

        confirmPassword = new AjaxPasswordFieldPanel("confirmPassword",
                "confirmPassword", new Model<String>(), true);
        if (!resetPassword) {
            confirmPassword.getField().setModelObject(
                    userTO.getPassword());
        }
        confirmPassword.setRequired(userTO.getId() == 0);
        ((PasswordTextField) confirmPassword.getField()).setResetPassword(
                resetPassword);

        form.add(new EqualPasswordInputValidator(
                password.getField(), confirmPassword.getField()));
    }
    add(password);
    add(confirmPasswordLabel);
    add(confirmPassword);

    final WebMarkupContainer mandatoryPassword =
            new WebMarkupContainer("mandatory_pwd");
    mandatoryPassword.add(new Behavior() {

        private static final long serialVersionUID =
                1469628524240283489L;

        @Override
        public void onComponentTag(
                final Component component, final ComponentTag tag) {

            if (userTO.getId() > 0) {
                tag.put("style", "display:none;");
            }
        }
    });

    add(mandatoryPassword);
    // ------------------------
}
 
开发者ID:ilgrosso,项目名称:oldSyncopeIdM,代码行数:82,代码来源:UserDetailsPanel.java

示例6: ResetPasswordPanel

import org.apache.wicket.markup.html.form.validation.EqualPasswordInputValidator; //导入依赖的package包/类
protected ResetPasswordPanel(String id) {
    super(id);
    setVersioned(false);

    final String passwordGenKey = WicketUtils.getParameter("key");

    //If there is no key supplied, redirect to the login page
    if (StringUtils.isEmpty(passwordGenKey)) {
        setResponse();
        return;
    }

    //If user is found
    final UserInfo userInfo = findUserByKey(passwordGenKey);
    if (userInfo != null) {
        Form resetForm = new SecureForm("resetForm");

        resetForm.add(new LabeledValue("description",
                "Please choose a new password."));

        final PasswordTextField passwordTextField = new PasswordTextField("password", new Model<String>());
        passwordTextField.setRequired(true);
        passwordTextField.add(PasswordStrengthValidator.getInstance());
        resetForm.add(passwordTextField);
        PasswordTextField retypedPasswordTextField = new PasswordTextField("retypedPassword", new Model<String>());
        retypedPasswordTextField.setRequired(true);
        resetForm.add(retypedPasswordTextField);

        // validate password and retyped password
        resetForm.add(new EqualPasswordInputValidator(passwordTextField, retypedPasswordTextField));

        addButton(new TitledAjaxSubmitLink("reset", "Reset My Password", resetForm) {

            @Override
            protected void onSubmit(AjaxRequestTarget target, Form form) {
                /**
                 * We double check the key validity, since after the first reset, the user can back up into the page
                 * And won't have to pass the validity checks on init
                 */
                MutableUserInfo user = InfoFactoryHolder.get().copyUser(
                        userGroupService.findUser(userInfo.getUsername()));
                String passwordKey = user.getGenPasswordKey();
                if ((StringUtils.isEmpty(passwordKey)) || (!passwordKey.equals(passwordGenKey))) {
                    invalidKeyResponse();
                    return;
                }
                String chosenPassword = passwordTextField.getValue();
                user.setPassword(securityService.generateSaltedPassword(chosenPassword));
                user.setGenPasswordKey(null);
                userGroupService.updateUser(user, false);
                log.info("The user: '{}' has successfully reset his password.", user.getUsername());
                Session.get().info("Password reset successfully.");
                setResponse();
            }
        });

        add(resetForm);
    }
}
 
开发者ID:alancnet,项目名称:artifactory,代码行数:60,代码来源:ResetPasswordPanel.java

示例7: CloneUserPage

import org.apache.wicket.markup.html.form.validation.EqualPasswordInputValidator; //导入依赖的package包/类
public CloneUserPage(PageParameters params) {
    super(ListUsersPage.class, params);

    final long userId = params.get("userId").toLong();
    final UIUser oldUser = userService.getUser(userId);

    final UIUserWithPassword2 user = new UIUserWithPassword2();
    Form<UIUserWithPassword2> form = new Form<UIUserWithPassword2>("form", new Model<UIUserWithPassword2>(user)) {
        @Override
        protected void onSubmit() {
            UserCloningResult result = userService.cloneUser(userId, user.getUsername(), user.getPassword(),
                    user.getEmail(), user.getPublicKey(),
                    user.getSubsystemForEmail() == null ? null : user.getSubsystemForEmail().getName());
            if (result.getMailSendError() != null) {
                warn("Could not send a message: " + result.getMailSendError());
            }
            getRequestCycle().setResponsePage(ListUsersPage.class);
            info("User cloned: " + oldUser.getUsername() + " to " + user.getUsername());
        }
    };
    add(form);
    form.add(new LabelValueRow<String>("old-username", new Model<String>(oldUser.getUsername()),"user.clone.template-name"));

    LabelTextFieldRow<String> userName = new LabelTextFieldRow<String>(user,"username","user.create.username",true);
    form.add(userName);

    LabelTextFieldRow<String> email = new LabelTextFieldRow<String>(user, "email", "user.create.email", true);
    email.getTextField().add(EmailAddressValidator.getInstance());
    form.add(email);

    LabelPasswordTextFieldRow password1Field = new LabelPasswordTextFieldRow(user, "password", "user.create.password", true);
    form.add(password1Field);

    LabelPasswordTextFieldRow password2Field = new LabelPasswordTextFieldRow(user, "password2", "user.create.password2", true);
    form.add(password2Field);

    form.add(new EqualPasswordInputValidator(password1Field.getPasswordTextField(), password2Field.getPasswordTextField()));

    form.add(new PasswordInputValidator(userName.getTextField(), password1Field.getPasswordTextField(), userService));

    LabelTextAreaRow<String> publicKeyField = new LabelTextAreaRow<String>(user, "publicKey", "user.create.publicKey");
    publicKeyField.getTextField().add(new PublicKeyValidator(crypto));
    form.add(publicKeyField);

    form.add(new LabelDropDownChoiceRow<UISubsystemForFilter>("subsystemForEmail", user, "user.subsystemForEmail",
            subsystemService.getSubsystemsForFilter(), new SubsystemChoiceRenderer()));

    form.add(new BookmarkablePageLink<Page>("cancel", ListUsersPage.class));
}
 
开发者ID:payneteasy,项目名称:superfly,代码行数:50,代码来源:CloneUserPage.java

示例8: RegisterPage

import org.apache.wicket.markup.html.form.validation.EqualPasswordInputValidator; //导入依赖的package包/类
public RegisterPage(PageParameters parameters) {
	super(parameters);

	Form<User> form = new InputValidationForm<User>("form") {

		@Override
		protected void onSubmit() {
			tryToRegister();
		}
	};

	mail = new TextField<>("mail", new PropertyModel<String>(newUser, "mail"));
	InputBorder<String> mailValidationBorder = new OnEventInputBeanValidationBorder<>(
			"mailValidationBorder", mail,
			new StringResourceModel("label.mail", this, null),
			new StringResourceModel("help.mail", this, null),
			HtmlEvent.ONBLUR);
	form.add(mailValidationBorder);

	userName = new TextField<>("userName", new PropertyModel<String>(newUser, "userName"));
	InputBorder<String> userNameValidationBorder = new OnEventInputBeanValidationBorder<>(
			"userNameValidationBorder", userName,
			new StringResourceModel("label.userName", this, null),
			new StringResourceModel("help.userName", this, null),
			HtmlEvent.ONBLUR);
	form.add(userNameValidationBorder);

	firstName = new TextField<>("firstName", new PropertyModel<String>(newUser, "firstName"));
	InputBorder<String> firstNameValidationBorder = new OnEventInputBeanValidationBorder<>(
			"firstNameValidationBorder", firstName,
			new StringResourceModel("label.firstName", this, null), HtmlEvent.ONBLUR);
	form.add(firstNameValidationBorder);

	lastName = new TextField<>("lastName", new PropertyModel<String>(newUser, "lastName"));
	InputBorder<String> lastNameValidationBorder = new OnEventInputBeanValidationBorder<>(
			"lastNameValidationBorder", lastName,
			new StringResourceModel("label.lastName", this, null), HtmlEvent.ONBLUR);
	form.add(lastNameValidationBorder);

	password = new PasswordTextField("password", Model.of(""));
	password.add(new PatternValidator(AuthenticationService.PW_PATTERN));
	InputBorder<String> passwordValidationBorder = new InputBorder(
			"passwordValidationBorder", password,
			new StringResourceModel("label.password", this, null),
			new StringResourceModel("help.password", this, null));
	form.add(passwordValidationBorder);

	confirmPassword = new PasswordTextField("confirmPassword", Model.of(""));
	InputBorder<String> confirmPasswordValidationBorder = new InputBorder(
			"confirmPasswordValidationBorder", confirmPassword,
			new StringResourceModel("label.password.confirm", this, null));
	form.add(confirmPasswordValidationBorder);
	form.add(new EqualPasswordInputValidator(password, confirmPassword));
	
	add(form);
}
 
开发者ID:U-QASAR,项目名称:u-qasar.platform,代码行数:57,代码来源:RegisterPage.java


注:本文中的org.apache.wicket.markup.html.form.validation.EqualPasswordInputValidator类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。