mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-12-04 15:39:34 +01:00
Fix handling of small passphrase wordlists
* Fixes #11856 * Set the minimum recommended wordlist size to 1,296 - equal to the EFF Short List * Issue a clear warning when using a smaller wordlist but do not prevent generation of passphrases * Improve wording when removing custom wordlist
This commit is contained in:
@@ -99,7 +99,7 @@ void PassphraseGenerator::setWordList(const QString& path)
|
||||
|
||||
m_wordlist = wordset.toList();
|
||||
|
||||
if (m_wordlist.size() < m_minimum_wordlist_length) {
|
||||
if (!isWordListValid()) {
|
||||
qWarning("Wordlist is less than minimum acceptable size: %s", qPrintable(path));
|
||||
}
|
||||
}
|
||||
@@ -117,8 +117,7 @@ void PassphraseGenerator::setWordSeparator(const QString& separator)
|
||||
|
||||
QString PassphraseGenerator::generatePassphrase() const
|
||||
{
|
||||
// In case there was an error loading the wordlist
|
||||
if (!isValid() || m_wordlist.empty()) {
|
||||
if (m_wordlist.isEmpty()) {
|
||||
return {};
|
||||
}
|
||||
|
||||
@@ -149,7 +148,7 @@ QString PassphraseGenerator::generatePassphrase() const
|
||||
return words.join(m_separator);
|
||||
}
|
||||
|
||||
bool PassphraseGenerator::isValid() const
|
||||
bool PassphraseGenerator::isWordListValid() const
|
||||
{
|
||||
return m_wordCount > 0 && m_wordlist.size() >= m_minimum_wordlist_length;
|
||||
return m_wordlist.size() >= m_minWordListSize;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user