Search in sources :

Example 1 with UserPojo

use of won.owner.pojo.UserPojo in project webofneeds by researchstudio-sat.

the class UserRegisterValidator method validate.

@Override
public void validate(final Object target, final Errors errors) {
    UserPojo user = (UserPojo) target;
    validator.validate(target, errors);
    if (user.getPassword().length() < 6) {
        errors.rejectValue("password", "passwordTooShort", "Password needs to be at least 6 Characters long");
    }
    if (errors.getFieldError("username") != null) {
        User userInDb = (User) wonUserDetailService.loadUserByUsername(user.getUsername());
        if (userInDb != null) {
            errors.reject("userIsAlreadyInDb", "Username already exists, please choose a different one");
        }
    }
}
Also used : User(won.owner.model.User) UserPojo(won.owner.pojo.UserPojo)

Aggregations

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