private static void AddPasswordHistoryEntry(Guid accountID, string password) { using (var db = new CustomDatabase()) { var pw = new PasswordHistory { UserID = accountID, DateChanged = DateTime.UtcNow, PasswordHash = new DefaultCrypto().HashPassword(password, 1000) }; db.PasswordHistory.Add(pw); db.SaveChanges(); } }
public void Handle(PasswordChangedEvent evt) { using (var db = new CustomDatabase()) { var pw = new PasswordHistory { UserID = evt.Account.ID, DateChanged = DateTime.UtcNow, PasswordHash = evt.Account.HashedPassword }; db.PasswordHistory.Add(pw); db.SaveChanges(); } }