Skip to content

Commit

Permalink
Merge pull request #19 from andrew-schofield/ignore-deleted-entries
Browse files Browse the repository at this point in the history
Ignore deleted entries. Fix #14
  • Loading branch information
andrew-schofield authored Apr 8, 2017
2 parents 7c37dc1 + b49e7fa commit d28c20f
Show file tree
Hide file tree
Showing 11 changed files with 43 additions and 16 deletions.
Binary file modified HaveIBeenPwned.plgx
Binary file not shown.
2 changes: 1 addition & 1 deletion HaveIBeenPwned/BaseChecker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ protected BaseChecker(PwDatabase database, HttpClient httpClient, IPluginHost pl
this.pluginHost = pluginHost;
}

public abstract Task<List<BreachedEntry>> CheckDatabase(bool expireEntries, bool oldEntriesOnly);
public abstract Task<List<BreachedEntry>> CheckDatabase(bool expireEntries, bool oldEntriesOnly, bool ignoreDeleted);

public abstract Image BreachLogo { get; }

Expand Down
28 changes: 22 additions & 6 deletions HaveIBeenPwned/CheckerPrompt.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions HaveIBeenPwned/CheckerPrompt.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,10 @@ public bool OnlyCheckOldEntries
{
get { return checkOldEntries.Checked; }
}

public bool IgnoreDeletedEntries
{
get { return ignoreDeletedEntries.Checked; }
}
}
}
4 changes: 2 additions & 2 deletions HaveIBeenPwned/CloudbleedChecker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ public override string BreachTitle
get { return "Cloudbleed Vulnerability"; }
}

public async override Task<List<BreachedEntry>> CheckDatabase(bool expireEntries, bool oldEntriesOnly)
public async override Task<List<BreachedEntry>> CheckDatabase(bool expireEntries, bool oldEntriesOnly, bool ignoreDeleted)
{
var breaches = await GetBreaches();
var entries = passwordDatabase.RootGroup.GetEntries(true);
var entries = passwordDatabase.RootGroup.GetEntries(true).Where(e => !ignoreDeleted || !e.IsDeleted(pluginHost));
var breachedEntries = new List<BreachedEntry>();
StatusProgressForm progressForm = new StatusProgressForm();
var cloudbleedEntry = new CloudbleedEntry();
Expand Down
4 changes: 2 additions & 2 deletions HaveIBeenPwned/HaveIBeenPwnedChecker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ public override string BreachTitle
get { return "Have I Been Pwned"; }
}

public async override Task<List<BreachedEntry>> CheckDatabase(bool expireEntries, bool oldEntriesOnly)
public async override Task<List<BreachedEntry>> CheckDatabase(bool expireEntries, bool oldEntriesOnly, bool ignoreDeleted)
{
var breaches = await GetBreaches();
var entries = passwordDatabase.RootGroup.GetEntries(true);
var entries = passwordDatabase.RootGroup.GetEntries(true).Where(e => !ignoreDeleted || !e.IsDeleted(pluginHost));
var breachedEntries = new List<BreachedEntry>();
StatusProgressForm progressForm = new StatusProgressForm();

Expand Down
2 changes: 1 addition & 1 deletion HaveIBeenPwned/HaveIBeenPwnedExt.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ private void CheckBreaches(BaseChecker breachChecker)
var dialog = new CheckerPrompt(breachChecker.BreachLogo, breachChecker.BreachTitle);
if (dialog.ShowDialog() == DialogResult.OK)
{
var breachedEntries = breachChecker.CheckDatabase(dialog.ExpireEntries, dialog.OnlyCheckOldEntries);
var breachedEntries = breachChecker.CheckDatabase(dialog.ExpireEntries, dialog.OnlyCheckOldEntries, dialog.IgnoreDeletedEntries);
breachedEntries.ContinueWith((result) =>
{
// make sure any exceptions we aren't catching ourselves (like URIFormatException) are thrown correctly
Expand Down
4 changes: 2 additions & 2 deletions HaveIBeenPwned/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.2.7.0")]
[assembly: AssemblyFileVersion("0.2.7.0")]
[assembly: AssemblyVersion("0.2.8.0")]
[assembly: AssemblyFileVersion("0.2.8.0")]
8 changes: 7 additions & 1 deletion HaveIBeenPwned/PwEntryExtension.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using KeePassLib;
using KeePass.Plugins;
using KeePassLib;
using System;
using System.Linq;

Expand All @@ -23,5 +24,10 @@ public static DateTime GetPasswordLastModified(this PwEntry entry)

return entry.LastModificationTime;
}

public static bool IsDeleted(this PwEntry entry, IPluginHost pluginHost)
{
return entry.ParentGroup.Uuid.CompareTo(pluginHost.Database.RecycleBinUuid) == 0;
}
}
}
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
:
HaveIBeenPwned checker:0.2.7
HaveIBeenPwned checker:0.2.8
:
Binary file modified mono/HaveIBeenPwned.dll
Binary file not shown.

0 comments on commit d28c20f

Please sign in to comment.