createComponents();
}
private void createComponents()
{
final PasswordTextField oldField = new PasswordTextField("old");
oldField.setLabel(new Model("Ancien mot de passe"));
oldField.setResetPassword(false);
form.add(oldField);
final PasswordTextField passwordField = new PasswordTextField(
"password");
oldField.setLabel(new Model("Nouveau mot de passe"));
oldField.setResetPassword(false);
form.add(passwordField);
final PasswordTextField confirmField = new PasswordTextField("confirm");
oldField.setLabel(new Model("Mot de passe de confirmation"));
oldField.setResetPassword(false);
form.add(confirmField);
form.add(new AbstractFormValidator()
{
private static final long serialVersionUID = -4332406421709141133L;
public FormComponent[] getDependentFormComponents()
{
return new FormComponent[]
{ passwordField, confirmField };
}
public void validate(final Form form)
{
final String password = passwordField.getInput();
final String confirm = confirmField.getInput();
if (!password.equals(confirm))
{
form.error(form.getLocalizer().getString(
"passwordsDoNotMatch", form));
}