Esempio n. 1
0
        public async Task <UserCompleteDTO> LoginUserCheck(UserLoginDTO userLoginDTO)
        {
            UserAuthDTO userAuthInfo = UserDBContext.GetCredentialsByEmail(userLoginDTO.Email);

            if (userAuthInfo == null)
            {
                throw new Exceptions.InvalidCredentialsException("Email not found");
            }
            if (PasswordHasher.ValidatePassword(userLoginDTO.Password, userAuthInfo.Password))
            {
                UserCompleteDTO userCompleteDTO = await UserDBContext.GetUserCompleteInfo(userAuthInfo);

                return(userCompleteDTO);
            }
            else
            {
                throw new Exceptions.InvalidCredentialsException("Password is Incorrect");
            }
        }