List of usage examples for org.apache.wicket.markup.html.form PasswordTextField setResetPassword
public final PasswordTextField setResetPassword(final boolean resetPassword)
From source file:com.evolveum.midpoint.gui.api.component.password.PasswordPanel.java
License:Apache License
private void initLayout(final IModel<ProtectedStringType> model, final boolean isReadOnly, boolean showRemoveButton) { setOutputMarkupId(true);//from w w w .jav a 2s .co m passwordInputVisble = model.getObject() == null; // TODO: remove // LOGGER.trace("PASSWORD model: {}", model.getObject()); final WebMarkupContainer inputContainer = new WebMarkupContainer(ID_INPUT_CONTAINER) { @Override public boolean isVisible() { return passwordInputVisble; } }; inputContainer.setOutputMarkupId(true); add(inputContainer); final PasswordTextField password1 = new PasswordTextField(ID_PASSWORD_ONE, new PasswordModel(model)); password1.setRequired(false); password1.setResetPassword(false); password1.setOutputMarkupId(true); password1.add(new EmptyOnBlurAjaxFormUpdatingBehaviour()); inputContainer.add(password1); final PasswordTextField password2 = new PasswordTextField(ID_PASSWORD_TWO, new Model<String>()); password2.setRequired(false); password2.setResetPassword(false); password2.setOutputMarkupId(true); password2.add(new EmptyOnBlurAjaxFormUpdatingBehaviour()); inputContainer.add(password2); password1.add(new AjaxFormComponentUpdatingBehavior("change") { @Override protected void onUpdate(AjaxRequestTarget target) { boolean required = !StringUtils.isEmpty(password1.getModel().getObject()); password2.setRequired(required); //fix of MID-2463 // target.add(password2); // target.appendJavaScript("$(\"#"+ password2.getMarkupId() +"\").focus()"); } }); password2.add(new PasswordValidator(password1, password2)); final WebMarkupContainer linkContainer = new WebMarkupContainer(ID_LINK_CONTAINER) { @Override public boolean isVisible() { return !passwordInputVisble; } }; inputContainer.setOutputMarkupId(true); linkContainer.setOutputMarkupId(true); add(linkContainer); final Label passwordSetLabel = new Label(ID_PASSWORD_SET, new ResourceModel("passwordPanel.passwordSet")); linkContainer.add(passwordSetLabel); final Label passwordRemoveLabel = new Label(ID_PASSWORD_REMOVE, new ResourceModel("passwordPanel.passwordRemoveLabel")); passwordRemoveLabel.setVisible(false); linkContainer.add(passwordRemoveLabel); AjaxLink link = new AjaxLink(ID_CHANGE_PASSWORD_LINK) { @Override public void onClick(AjaxRequestTarget target) { onLinkClick(target); } @Override public boolean isVisible() { return !passwordInputVisble; } }; link.add(new VisibleEnableBehaviour() { @Override public boolean isVisible() { return !isReadOnly; } }); link.setBody(new ResourceModel("passwordPanel.passwordChange")); link.setOutputMarkupId(true); linkContainer.add(link); final WebMarkupContainer removeButtonContainer = new WebMarkupContainer(ID_REMOVE_BUTTON_CONTAINER); AjaxLink removePassword = new AjaxLink(ID_REMOVE_PASSWORD_LINK) { @Override public void onClick(AjaxRequestTarget target) { onRemovePassword(model, target); } }; removePassword.setVisible(showRemoveButton); removePassword.setBody(new ResourceModel("passwordPanel.passwordRemove")); removePassword.setOutputMarkupId(true); removeButtonContainer.add(removePassword); add(removeButtonContainer); }
From source file:com.evolveum.midpoint.web.component.input.PasswordPanel.java
License:Apache License
private void initLayout(IModel<String> model) { final PasswordTextField password1 = new PasswordTextField(ID_PASSWORD_ONE, model); password1.setRequired(false);/* www .jav a2s.c o m*/ password1.setResetPassword(false); password1.setOutputMarkupId(true); password1.add(new EmptyOnBlurAjaxFormUpdatingBehaviour()); add(password1); final PasswordTextField password2 = new PasswordTextField(ID_PASSWORD_TWO, new Model<String>()); password2.setRequired(false); password2.setResetPassword(false); password2.setOutputMarkupId(true); password2.add(new EmptyOnBlurAjaxFormUpdatingBehaviour()); add(password2); password1.add(new AjaxFormComponentUpdatingBehavior("onChange") { @Override protected void onUpdate(AjaxRequestTarget target) { boolean required = !StringUtils.isEmpty(password1.getModel().getObject()); password2.setRequired(required); target.add(password2); target.appendJavaScript("$(\"#" + password2.getMarkupId() + "\").focus()"); } }); password2.add(new PasswordValidator(password1, password2)); }
From source file:com.evolveum.midpoint.web.page.self.component.ChangePasswordPanel.java
License:Apache License
private void initLayout() { model = (LoadableModel<MyPasswordsDto>) getModel(); Label oldPasswordLabel = new Label(ID_OLD_PASSWORD_LABEL, createStringResource("PageSelfCredentials.oldPasswordLabel")); add(oldPasswordLabel);/*from w w w. j a v a 2 s . co m*/ Label passwordLabel = new Label(ID_PASSWORD_LABEL, createStringResource("PageSelfCredentials.passwordLabel1")); add(passwordLabel); PasswordTextField oldPasswordField = new PasswordTextField(ID_OLD_PASSWORD_FIELD, new PropertyModel<String>(model, MyPasswordsDto.F_OLD_PASSWORD)); oldPasswordField.setRequired(false); oldPasswordField.setResetPassword(false); add(oldPasswordField); if (model.getObject().getPasswordChangeSecurity() != null && model.getObject().getPasswordChangeSecurity().equals(PasswordChangeSecurityType.NONE)) { oldPasswordField.setVisible(false); oldPasswordLabel.setVisible(false); } PasswordPanel passwordPanel = new PasswordPanel(ID_PASSWORD_PANEL, new PropertyModel<ProtectedStringType>(model, MyPasswordsDto.F_PASSWORD)); passwordPanel.getBaseFormComponent().add(new AttributeModifier("autofocus", "")); add(passwordPanel); WebMarkupContainer accountContainer = new WebMarkupContainer(ID_ACCOUNTS_CONTAINER); List<IColumn<PasswordAccountDto, String>> columns = initColumns(); ListDataProvider<PasswordAccountDto> provider = new ListDataProvider<PasswordAccountDto>(this, new PropertyModel<List<PasswordAccountDto>>(model, MyPasswordsDto.F_ACCOUNTS)); TablePanel accounts = new TablePanel(ID_ACCOUNTS_TABLE, provider, columns); accounts.setItemsPerPage(30); accounts.setShowPaging(false); if (model.getObject().getPropagation() != null && model.getObject().getPropagation().equals(CredentialsPropagationUserControlType.MAPPING)) { accountContainer.setVisible(false); } accountContainer.add(accounts); AjaxLink help = new AjaxLink(ID_BUTTON_HELP) { private static final long serialVersionUID = 1L; @Override public void onClick(AjaxRequestTarget target) { showHelpPerformed(target); } }; accountContainer.add(help); add(accountContainer); }
From source file:com.googlecode.wicketwebbeans.fields.PasswordField.java
License:Apache License
/** * Construct a new PasswordField./*w w w . j a v a 2 s .c o m*/ * * @param id the Wicket id for the editor. * @param model the model. * @param metaData the meta data for the property. * @param viewOnly true if the component should be view-only. */ public PasswordField(String id, IModel<String> model, ElementMetaData metaData, boolean viewOnly) { super(id, model, metaData, viewOnly); Fragment fragment; if (viewOnly) { fragment = new Fragment("frag", "viewer", this); fragment.add(new LabelWithMinSize("component", "*****")); } else { fragment = new Fragment("frag", "editor", this); PasswordTextField field = new PasswordTextField("component", model); field.setResetPassword(false); field.setRequired(false); setFieldParameters(field); fragment.add(field); } add(fragment); }
From source file:dk.teachus.frontend.pages.UnAuthenticatedBasePage.java
License:Apache License
private void createSignInBox() { add(new Label("signInLabel", TeachUsSession.get().getString("General.signIn"))); //$NON-NLS-1$ //$NON-NLS-2$ add(new FeedbackPanel("feedback")); user = new User(); final Form<User> signInForm = new Form<User>("signInForm", new CompoundPropertyModel<User>(user)) { //$NON-NLS-1$ private static final long serialVersionUID = 1L; @Override/*from w ww . j av a2 s. c o m*/ protected void onSubmit() { signin(); } }; add(signInForm); final TextField<String> username = new TextField<String>("username"); //$NON-NLS-1$ username.setOutputMarkupId(true); username.setRequired(true); username.add(new DefaultFocusBehavior()); username.add(AttributeModifier.replace("placeholder", TeachUsSession.get().getString("General.username"))); signInForm.add(username); final PasswordTextField password = new PasswordTextField("password"); password.setResetPassword(false); password.add(AttributeModifier.replace("placeholder", TeachUsSession.get().getString("General.password"))); signInForm.add(password); signInForm.add(new Button("signIn", new Model<String>("Log ind"))); }
From source file:it.av.eatt.web.page.UserAccountPage.java
License:Apache License
public UserAccountPage(PageParameters pageParameters) throws JackWicketException { if (!pageParameters.containsKey(YoueatHttpParams.PARAM_YOUEAT_ID)) { throw new JackWicketException("Missing user id"); }// w w w. j a v a2 s .c o m String eaterId = pageParameters.getString(YoueatHttpParams.PARAM_YOUEAT_ID, ""); StringValidator pwdValidator = StringValidator.LengthBetweenValidator.lengthBetween(6, 20); eater = eaterService.getByID(eaterId); Form<Eater> form = new Form<Eater>("account", new CompoundPropertyModel<Eater>(eater)); form.setOutputMarkupId(true); add(form); form.add(new Label("email")); form.add(new RequiredTextField<String>("firstname")); form.add(new RequiredTextField<String>("lastname")); form.add(new DropDownChoice<Language>("language", languageService.getAll(), new LanguageRenderer())); PasswordTextField oldPassword = new PasswordTextField("oldPassword", new Model<String>(oldPasswordValue)); oldPassword.add(new OldPasswordValidator()); form.add(oldPassword); PasswordTextField pwd1 = new PasswordTextField("newPassword", new Model<String>(newPasswordValue)); pwd1.setRequired(false); pwd1.add(pwdValidator); pwd1.setResetPassword(false); form.add(pwd1); PasswordTextField pwd2 = new PasswordTextField("password-confirm", new Model<String>(confirmPassword)); pwd2.setRequired(false); form.add(pwd2); EqualPasswordInputValidator passwordInputValidator = new EqualPasswordInputValidator(pwd1, pwd2); form.add(passwordInputValidator); form.add(new SubmitButton("saveAccount", form)); }
From source file:it.av.es.web.UserAccountPage.java
License:Apache License
public UserAccountPage() { super();//from w ww . ja v a 2 s . c o m getAccountForm().add(new Label("email")); StringValidator pwdValidator = StringValidator.lengthBetween(6, 20); PasswordTextField oldPassword = new PasswordTextField("oldPassword", new Model<String>(oldPasswordValue)); oldPassword.add(new OldPasswordValidator(getAccountForm())); getAccountForm().add(oldPassword); PasswordTextField pwd1 = new PasswordTextField("newPassword", new Model<String>(newPasswordValue)); pwd1.setRequired(false); pwd1.add(pwdValidator); pwd1.setResetPassword(false); getAccountForm().add(pwd1); PasswordTextField pwd2 = new PasswordTextField("password-confirm", new Model<String>(confirmPassword)); pwd2.setRequired(false); getAccountForm().add(pwd2); EqualPasswordInputValidator passwordInputValidator = new EqualPasswordInputValidator(pwd1, pwd2); getAccountForm().add(passwordInputValidator); getAccountForm().add(new SubmitButton("saveAccount", getAccountForm())); }
From source file:it.av.youeat.web.page.EaterAccountPage.java
License:Apache License
public EaterAccountPage(PageParameters pageParameters) { super(pageParameters); getAccountForm().add(new Label("email")); StringValidator pwdValidator = StringValidator.LengthBetweenValidator.lengthBetween(6, 20); PasswordTextField oldPassword = new PasswordTextField("oldPassword", new Model<String>(oldPasswordValue)); oldPassword.add(new OldPasswordValidator(getAccountForm())); oldPassword.setEnabled(!getLoggedInUser().isSocialNetworkEater()); getAccountForm().add(oldPassword);//from w w w .j a va2s .c o m PasswordTextField pwd1 = new PasswordTextField("newPassword", new Model<String>(newPasswordValue)); pwd1.setRequired(false); pwd1.setEnabled(!getLoggedInUser().isSocialNetworkEater()); pwd1.add(pwdValidator); pwd1.setResetPassword(false); getAccountForm().add(pwd1); PasswordTextField pwd2 = new PasswordTextField("password-confirm", new Model<String>(confirmPassword)); pwd2.setRequired(false); pwd2.setEnabled(!getLoggedInUser().isSocialNetworkEater()); getAccountForm().add(pwd2); EqualPasswordInputValidator passwordInputValidator = new EqualPasswordInputValidator(pwd1, pwd2); getAccountForm().add(passwordInputValidator); DropDownChoice<Sex> sexField = new DropDownChoice<Sex>("sex", Arrays.asList(Sex.values())); sexField.setRequired(true); getAccountForm().add(sexField); getAccountForm().add(new SubmitButton("saveAccount", getAccountForm())); }
From source file:net.rrm.ehour.ui.admin.config.panel.MailServerConfigPanel.java
License:Open Source License
@Override protected void onInitialize() { super.onInitialize(); Form<MainConfigBackingBean> form = new Form<>("smtpForm", getPanelModel()); add(form);/* w w w . j a va 2s.c om*/ Container disabled = new Container("mailDisabled"); disabled.setVisible(!mailMain.isMailEnabled()); form.add(disabled); // reply sender TextField<String> mailFrom = new TextField<>("config.mailFrom"); mailFrom.setLabel(new ResourceModel("admin.config.mailFrom")); mailFrom.add(EmailAddressValidator.getInstance()); mailFrom.add(new ValidatingFormComponentAjaxBehavior()); form.add(mailFrom); form.add(new AjaxFormComponentFeedbackIndicator("mailFromError", mailFrom)); // smtp server, port, username, pass TextField<String> mailSmtp = new TextField<>("config.mailSmtp"); mailSmtp.setLabel(new ResourceModel("admin.config.mailSmtp")); mailSmtp.add(new ValidatingFormComponentAjaxBehavior()); form.add(new AjaxFormComponentFeedbackIndicator("mailSmtpValidationError", mailSmtp)); form.add(mailSmtp); TextField<Integer> smtpPort = new TextField<>("config.smtpPort"); smtpPort.setLabel(new ResourceModel("admin.config.smtpPort")); smtpPort.add(new ValidatingFormComponentAjaxBehavior()); form.add(new AjaxFormComponentFeedbackIndicator("smtpPortValidationError", mailSmtp)); smtpPort.setType(Integer.class); smtpPort.add(RangeValidator.minimum(0)); form.add(smtpPort); TextField<String> smtpUsername = new TextField<>("config.smtpUsername"); smtpUsername.setLabel(new ResourceModel("admin.config.smtpUsername")); form.add(smtpUsername); PasswordTextField smtpPassword = new PasswordTextField("config.smtpPassword"); smtpPassword.setResetPassword(false); smtpPassword.setRequired(false); smtpPassword.setLabel(new ResourceModel("admin.config.smtpPassword")); form.add(smtpPassword); addTestMailSettingsButton(form); }
From source file:org.apache.isis.viewer.wicket.ui.components.scalars.isisapplib.IsisPasswordPanel.java
License:Apache License
@Override protected AbstractTextComponent<String> createTextFieldForRegular() { final PasswordTextField passwordField = new PasswordTextField(idTextField, new Model<String>() { private static final long serialVersionUID = 1L; @Override/*w w w .jav a 2 s. c o m*/ public String getObject() { return getModel().getObjectAsString(); } @Override public void setObject(final String object) { if (object == null) { getModel().setObject(null); } else { getModel().setObjectAsString(object); } } }) { @Override protected void onComponentTag(ComponentTag tag) { Attributes.set(tag, "type", "password"); super.onComponentTag(tag); } }; passwordField.setResetPassword(false); return passwordField; }