Skip to content

Commit

Permalink
Add number of known bad passwords to the Statistics report
Browse files Browse the repository at this point in the history
  • Loading branch information
wolframroesler committed Apr 10, 2020
1 parent 50138f3 commit c1ebe27
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/gui/reports/ReportsWidgetStatistics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

#include "core/AsyncTask.h"
#include "core/Database.h"
#include "core/Global.h"
#include "core/Group.h"
#include "core/Metadata.h"
#include "core/PasswordHealth.h"
Expand All @@ -43,6 +44,7 @@ namespace
int nPwdsShort = 0; // Number of passwords 8 characters or less in size
int nPwdsUnique = 0; // Number of unique passwords
int nPwdsReused = 0; // Number of non-unique passwords
int nPwdsKnownBad = 0; // Number of known bad passwords
int pwdTotalLen = 0; // Total length of all passwords

// Ctor does all the work
Expand Down Expand Up @@ -138,6 +140,11 @@ namespace
++nPwdsWeak;
}

if (entry->customData()->contains(PasswordHealth::OPTION_KNOWN_BAD_PASSWD)
&& entry->customData()->value(PasswordHealth::OPTION_KNOWN_BAD_PASSWD) == TRUE_STR) {
++nPwdsKnownBad;
}

pwdTotalLen += pwd.size();
m_passwords[pwd]++;
}
Expand Down Expand Up @@ -235,6 +242,10 @@ void ReportsWidgetStatistics::calculateStats()
QString::number(stats->nPwdsWeak),
stats->nPwdsWeak > 0,
tr("Recommend using long, randomized passwords with a rating of 'good' or 'excellent'."));
addStatsRow(tr("Number of known bad passwords"),
QString::number(stats->nPwdsKnownBad),
stats->nPwdsKnownBad > 0,
tr("Having passwords that are known to be bad isn't necessarily a problem, but you should keep an eye on them."));
addStatsRow(tr("Average password length"),
tr("%1 characters").arg(stats->averagePwdLength()),
stats->isAvgPwdTooShort(),
Expand Down

0 comments on commit c1ebe27

Please sign in to comment.