Пример #1
0
        public static ValidatorResult ValidateLogin(UserLoginInputModel input)
        {
            var result = new ValidatorResult();

            if (!Validator.ValidateEmail(input.Email))
            {
                result.AddErrorMessage("Invalid email");
            }

            if (!Validator.ValidatePassword(input.Password))
            {
                result.AddErrorMessage("Invalid password");
            }

            return(result);
        }
Пример #2
0
        public static ValidatorResult ValidateRegister(UserRegisterInputModel input)
        {
            var result = new ValidatorResult();

            if (!Validator.ValidateEmail(input.Email))
            {
                result.AddErrorMessage("Invalid email");
            }

            if (!Validator.ValidateUsername(input.Username))
            {
                result.AddErrorMessage("Invalid username");
            }

            if (!Validator.ValidatePassword(input.Password))
            {
                result.AddErrorMessage("Invalid password");
            }

            return(result);
        }