Exemplo n.º 1
0
        public ResponseDto <bool> ExecuteStrategy()
        {
            var validationWrapper =
                new ValidationWrapper <LoginDto>(_loginDto, "UsernameAndPassword", new LoginDtoValidator());
            var validationResult = validationWrapper.ExecuteValidator();

            // Checking if there is an error in the validation
            if (!validationResult.Data)
            {
                // Return an error if validation fails
                return(new ResponseDto <bool>()
                {
                    Data = false,
                    Error = AuthenticationErrorMessages.USERNAME_PASSWORD_ERROR
                });
            }

            // Checking if user Exists
            var userExistanceValidator      = new UserValidator();
            var validateUserExistanceResult = userExistanceValidator.CheckIfUserExists(_loginDto.Username);

            if (!validateUserExistanceResult.Data)
            {
                return(new ResponseDto <bool>
                {
                    Data = false,
                    Error = AuthenticationErrorMessages.USERNAME_PASSWORD_ERROR
                });
            }

            // Returning the Dto Back if after it has been validated
            return(new ResponseDto <bool>
            {
                Data = true
            });
        }
 /// <summary>
 /// Constructor for ResetPasswordPreLogicValidationStrategy.
 /// <para>
 /// @author: Jennifer
 /// @update: 04/22/2018
 /// </para>
 /// </summary>
 /// <param name="resetPasswordDto"></param>
 /// <param name="validationType"></param>
 public ResetPasswordPreLogicValidationStrategy(ResetPasswordDto resetPasswordDto, string validationType)
 {
     _resetPasswordDto = resetPasswordDto;
     _validationType   = validationType;
     _userValidator    = new UserValidator();
 }
Exemplo n.º 3
0
 /// <summary>
 /// Defines a strategy for validating models before processing business logic
 /// before preforming CRUD Operations.
 /// The constructor
 /// @author Angelica Salas Tovar, Jennifer Nguyen
 /// </summary>
 /// <param name="userAccountDto"></param>
 public UsernameValidationStrategy(UserAccountDto userAccount)
 {
     _userAccountDto          = userAccount;
     _userAccountDtoValidator = new UserAccountDtoValidator();
     _userValidator           = new UserValidator();
 }
Exemplo n.º 4
0
 public CreateFirstTimeSsoUserPreLogicValidationStrategy(UserAccountDto userAccountDto)
 {
     _userAccountDto          = userAccountDto;
     _userAccountDtoValidator = new UserAccountDtoValidator();
     _userValidator           = new UserValidator();
 }