use of won.owner.pojo.ResetPasswordPojo in project webofneeds by researchstudio-sat.
the class ResetPasswordValidator method validate.
@Override
public void validate(final Object target, final Errors errors) {
ResetPasswordPojo changePasswordPojo = (ResetPasswordPojo) target;
validator.validate(target, errors);
if (changePasswordPojo.getNewPassword().length() < 6) {
errors.rejectValue("newPassword", "passwordTooShort", "Password needs to be at least 6 Characters long");
}
if (errors.getFieldError("username") != null) {
User userInDb = (User) wonUserDetailService.loadUserByUsername(changePasswordPojo.getUsername());
if (userInDb == null) {
errors.reject("userNotFound", "Username does not exist");
}
}
}
Aggregations