public async Task <User> LoginAsync(UserLoginResource credentials) { var user = await _context.Users.FirstOrDefaultAsync(u => u.UserName == credentials.Username.ToLower()); if (user == null || !_hashHelper.VerifyPasswordHash(credentials.Password, user.PasswordHash, user.PasswordSalt)) { return(null); } return(user); }
public User Authenticate(string email, string password) { if (string.IsNullOrEmpty(email) || string.IsNullOrEmpty(password)) { return(null); } var user = Get(email); if (user == null) { return(null); } if (!_helper.VerifyPasswordHash(password, user.PasswordHash, user.PasswordSalt)) { return(null); } return(user); }