Search in sources :

Example 16 with CreateUserCommand

use of org.asqatasun.webapp.command.CreateUserCommand in project Asqatasun by Asqatasun.

the class SignUpFormValidator method validate.

@Override
public void validate(Object target, Errors errors) {
    boolean hasMandatoryElementWrong = false;
    CreateUserCommand userSubscriptionCommand = (CreateUserCommand) target;
    if (!checkSiteUrl(userSubscriptionCommand, errors)) {
        hasMandatoryElementWrong = true;
    }
    if (!checkEmail(userSubscriptionCommand, errors)) {
        hasMandatoryElementWrong = true;
    }
    if (!checkPassword(userSubscriptionCommand, errors)) {
        hasMandatoryElementWrong = true;
    }
    //        }
    if (hasMandatoryElementWrong) {
        // if no URL is filled-in
        errors.rejectValue(GENERAL_ERROR_MSG_KEY, MANDATORY_FIELD_MSG_BUNDLE_KEY);
    }
}
Also used : CreateUserCommand(org.asqatasun.webapp.command.CreateUserCommand)

Aggregations

CreateUserCommand (org.asqatasun.webapp.command.CreateUserCommand)16 ExtendedModelMap (org.springframework.ui.ExtendedModelMap)10 Model (org.springframework.ui.Model)10 CreateUserFormValidator (org.asqatasun.webapp.validator.CreateUserFormValidator)6 BeanPropertyBindingResult (org.springframework.validation.BeanPropertyBindingResult)6 BindingResult (org.springframework.validation.BindingResult)6 MockHttpServletRequest (org.springframework.mock.web.MockHttpServletRequest)5 User (org.asqatasun.webapp.entity.user.User)4 HttpServletResponse (javax.servlet.http.HttpServletResponse)2 MockHttpServletResponse (org.springframework.mock.web.MockHttpServletResponse)2 ForbiddenUserException (org.asqatasun.webapp.exception.ForbiddenUserException)1