Esempio n. 1
0
  public void validate(Object arg0, Errors arg1) {
    RegisterForm registerForm = (RegisterForm) arg0;

    if (registerForm.getRegisterUser() == "" || registerForm.getRegisterUser().length() == 0) {
      arg1.reject("field.invalid");
    }
    if (registerForm.getRegisterPass() == "" || registerForm.getRegisterPass().length() == 0) {
      arg1.reject("field.invalid");
    }
    if (registerForm.getRegisterEmail() == "" || registerForm.getRegisterEmail().length() == 0) {
      arg1.reject("field.invalid");
    }
    // check if there is already a user with email
    if (userBusiness.isAlreadyRegistered(registerForm.getRegisterUser())) {
      arg1.rejectValue("registerUser", "username.exists.already");
    }
  }