示例#1
0
        public UserInfoDTO LoginUser(UserLoginDTO loggedInUserCredentialsDTO)
        {
            UserInfoDTO userDetailsDTO;

            if (UserDBContext.UserEmailExists(loggedInUserCredentialsDTO.Email))
            {
                userDetailsDTO = UserDBContext.GetUser(loggedInUserCredentialsDTO);
                if (PasswordHasher.VerifyPassword(loggedInUserCredentialsDTO.Password, userDetailsDTO.HashPassword))
                {
                    return(userDetailsDTO);
                }
                else
                {
                    throw new IncorrectPasswordException("Incorrect Password");
                }
            }
            else
            {
                throw new InvalidLoginException();
            }
        }