public async Task AddUserAsync(MockUser user, string password) { var userExsits = await UserExists(user); if (userExsits) { throw new Exception( "A user with that Email address already exists"); } var hasher = new MockPasswordHasher(); user.PasswordHash = hasher.CreateHash(password).ToString(); _dbContext.Users.Add(user); await _dbContext.SaveChangesAsync(); }
public bool PasswordIsValid(MockUser user, string password) { var hasher = new MockPasswordHasher(); var hash = hasher.CreateHash(password); return hash.Equals(user.PasswordHash); }