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