Search in sources :

Example 1 with ResetPasswordPojo

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");
        }
    }
}
Also used : ResetPasswordPojo(won.owner.pojo.ResetPasswordPojo) User(won.owner.model.User)

Aggregations

User (won.owner.model.User)1 ResetPasswordPojo (won.owner.pojo.ResetPasswordPojo)1