Exemplo n.º 1
0
        public async Task <User> VerifyLoginAsync(string email, string password)
        {
            var user = await _dataContext.Users.FirstOrDefaultAsync(x => x.Email.Equals(email));

            if (user != null && PasswordHashService.ValidatePassword(password, user.Password))
            {
                return(user);
            }

            return(null);
        }
Exemplo n.º 2
0
 public string ValidateLoginRequest(LoginRequest request, User user)
 {
     if (user == null)
     {
         return("No user is registered with this email");
     }
     if (user.Password == null)
     {
         return("User has only registered with an external provider");
     }
     if (!PasswordHashService.ValidatePassword(request.Password, user.Password))
     {
         return("Incorrect password");
     }
     return(null);
 }