add(new EqualPasswordConvertedInputValidator(password, verifyPassword));
}
@Override
protected void onSubmit() {
User user = getModelObject();
// TODO: commit this change in a better way
Databinder.getHibernateSession().beginTransaction();
user.setPassword(password.getModelObject());
user.setSecurityToken(null);
user.setValid(true); // if the user was not validated previously, changing password from email link will validate user
Databinder.getHibernateSession().getTransaction().commit();
info("Password changed.");
fields.setVisible(false); // don't show form when confirming success
if (CwmSession.get().isSignedIn())
eventService.saveEvent("user:change password", null, null); // TODO - do we care about this? If so, make it work for non-logged-in case.