func (this *LoginValidator) validateRequest(loginRequest *LoginRequest) (isValid bool, errorMessages []string) { if loginRequest.UserId == "" { errorMessages = append(errorMessages, this.ResourceProvider.GetString(configuration.R_LOGIN_USER_ID_REQUIRED)) } else if !valid.IsEmail(loginRequest.UserId) { errorMessages = append(errorMessages, this.ResourceProvider.GetString(configuration.R_LOGIN_USER_ID_INVALID_EMAIL)) } if loginRequest.Password == "" { errorMessages = append(errorMessages, this.ResourceProvider.GetString(configuration.R_LOGIN_PASSWORD_REQUIRED)) } else if !valid.IsPrintableASCII(loginRequest.Password) { errorMessages = append(errorMessages, this.ResourceProvider.GetString(configuration.R_LOGIN_PASSWORD_INVALID)) } isValid = len(errorMessages) == 0 return isValid, errorMessages }
func (i IsPrintableASCIIChecker) IsFormat(data string) bool { return govalidator.IsPrintableASCII(data) }