mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-01-27 23:07:11 -05:00
centralize every password generator default option. add extended ASCII to XC_HTTP generator
This commit is contained in:
parent
33b95836b9
commit
6723f4215a
@ -211,7 +211,7 @@ void BrowserSettings::setVivaldiSupport(bool enabled) {
|
|||||||
|
|
||||||
bool BrowserSettings::passwordUseNumbers()
|
bool BrowserSettings::passwordUseNumbers()
|
||||||
{
|
{
|
||||||
return config()->get("generator/Numbers", true).toBool();
|
return config()->get("generator/Numbers", PasswordGenerator::DefaultNumbers).toBool();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BrowserSettings::setPasswordUseNumbers(bool useNumbers)
|
void BrowserSettings::setPasswordUseNumbers(bool useNumbers)
|
||||||
@ -221,7 +221,7 @@ void BrowserSettings::setPasswordUseNumbers(bool useNumbers)
|
|||||||
|
|
||||||
bool BrowserSettings::passwordUseLowercase()
|
bool BrowserSettings::passwordUseLowercase()
|
||||||
{
|
{
|
||||||
return config()->get("generator/LowerCase", true).toBool();
|
return config()->get("generator/LowerCase", PasswordGenerator::DefaultLower).toBool();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BrowserSettings::setPasswordUseLowercase(bool useLowercase)
|
void BrowserSettings::setPasswordUseLowercase(bool useLowercase)
|
||||||
@ -231,7 +231,7 @@ void BrowserSettings::setPasswordUseLowercase(bool useLowercase)
|
|||||||
|
|
||||||
bool BrowserSettings::passwordUseUppercase()
|
bool BrowserSettings::passwordUseUppercase()
|
||||||
{
|
{
|
||||||
return config()->get("generator/UpperCase", true).toBool();
|
return config()->get("generator/UpperCase", PasswordGenerator::DefaultUpper).toBool();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BrowserSettings::setPasswordUseUppercase(bool useUppercase)
|
void BrowserSettings::setPasswordUseUppercase(bool useUppercase)
|
||||||
@ -241,7 +241,7 @@ void BrowserSettings::setPasswordUseUppercase(bool useUppercase)
|
|||||||
|
|
||||||
bool BrowserSettings::passwordUseSpecial()
|
bool BrowserSettings::passwordUseSpecial()
|
||||||
{
|
{
|
||||||
return config()->get("generator/SpecialChars", false).toBool();
|
return config()->get("generator/SpecialChars", PasswordGenerator::DefaultSpecial).toBool();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BrowserSettings::setPasswordUseSpecial(bool useSpecial)
|
void BrowserSettings::setPasswordUseSpecial(bool useSpecial)
|
||||||
@ -251,7 +251,7 @@ void BrowserSettings::setPasswordUseSpecial(bool useSpecial)
|
|||||||
|
|
||||||
bool BrowserSettings::passwordUseEASCII()
|
bool BrowserSettings::passwordUseEASCII()
|
||||||
{
|
{
|
||||||
return config()->get("generator/EASCII", false).toBool();
|
return config()->get("generator/EASCII", PasswordGenerator::DefaultEASCII).toBool();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BrowserSettings::setPasswordUseEASCII(bool useEASCII)
|
void BrowserSettings::setPasswordUseEASCII(bool useEASCII)
|
||||||
@ -261,7 +261,7 @@ void BrowserSettings::setPasswordUseEASCII(bool useEASCII)
|
|||||||
|
|
||||||
int BrowserSettings::passPhraseWordCount()
|
int BrowserSettings::passPhraseWordCount()
|
||||||
{
|
{
|
||||||
return config()->get("generator/WordCount", 6).toInt();
|
return config()->get("generator/WordCount", PassphraseGenerator::DefaultWordCount).toInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BrowserSettings::setPassPhraseWordCount(int wordCount)
|
void BrowserSettings::setPassPhraseWordCount(int wordCount)
|
||||||
@ -271,7 +271,7 @@ void BrowserSettings::setPassPhraseWordCount(int wordCount)
|
|||||||
|
|
||||||
QString BrowserSettings::passPhraseWordSeparator()
|
QString BrowserSettings::passPhraseWordSeparator()
|
||||||
{
|
{
|
||||||
return config()->get("generator/WordSeparator", " ").toString();
|
return config()->get("generator/WordSeparator", PassphraseGenerator::DefaultSeparator).toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BrowserSettings::setPassPhraseWordSeparator(QString separator)
|
void BrowserSettings::setPassPhraseWordSeparator(QString separator)
|
||||||
@ -291,7 +291,7 @@ void BrowserSettings::setGeneratorType(int type)
|
|||||||
|
|
||||||
bool BrowserSettings::passwordEveryGroup()
|
bool BrowserSettings::passwordEveryGroup()
|
||||||
{
|
{
|
||||||
return config()->get("generator/EnsureEvery", true).toBool();
|
return config()->get("generator/EnsureEvery", PasswordGenerator::DefaultFromEveryGroup).toBool();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BrowserSettings::setPasswordEveryGroup(bool everyGroup)
|
void BrowserSettings::setPasswordEveryGroup(bool everyGroup)
|
||||||
@ -301,7 +301,7 @@ void BrowserSettings::setPasswordEveryGroup(bool everyGroup)
|
|||||||
|
|
||||||
bool BrowserSettings::passwordExcludeAlike()
|
bool BrowserSettings::passwordExcludeAlike()
|
||||||
{
|
{
|
||||||
return config()->get("generator/ExcludeAlike", true).toBool();
|
return config()->get("generator/ExcludeAlike", PasswordGenerator::DefaultLookAlike).toBool();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BrowserSettings::setPasswordExcludeAlike(bool excludeAlike)
|
void BrowserSettings::setPasswordExcludeAlike(bool excludeAlike)
|
||||||
@ -311,7 +311,7 @@ void BrowserSettings::setPasswordExcludeAlike(bool excludeAlike)
|
|||||||
|
|
||||||
int BrowserSettings::passwordLength()
|
int BrowserSettings::passwordLength()
|
||||||
{
|
{
|
||||||
return config()->get("generator/Length", 20).toInt();
|
return config()->get("generator/Length", PasswordGenerator::DefaultLength).toInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BrowserSettings::setPasswordLength(int length)
|
void BrowserSettings::setPasswordLength(int length)
|
||||||
|
@ -91,6 +91,11 @@ QString FilePath::pluginPath(const QString& name)
|
|||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString FilePath::wordlistPath(const QString& name)
|
||||||
|
{
|
||||||
|
return m_instance->dataPath("wordlists/" + name);
|
||||||
|
}
|
||||||
|
|
||||||
QIcon FilePath::applicationIcon()
|
QIcon FilePath::applicationIcon()
|
||||||
{
|
{
|
||||||
bool darkIcon = useDarkIcon();
|
bool darkIcon = useDarkIcon();
|
||||||
|
@ -27,6 +27,7 @@ class FilePath
|
|||||||
public:
|
public:
|
||||||
QString dataPath(const QString& name);
|
QString dataPath(const QString& name);
|
||||||
QString pluginPath(const QString& name);
|
QString pluginPath(const QString& name);
|
||||||
|
QString wordlistPath(const QString& name);
|
||||||
QIcon applicationIcon();
|
QIcon applicationIcon();
|
||||||
QIcon trayIconLocked();
|
QIcon trayIconLocked();
|
||||||
QIcon trayIconUnlocked();
|
QIcon trayIconUnlocked();
|
||||||
|
@ -24,9 +24,12 @@
|
|||||||
#include "crypto/Random.h"
|
#include "crypto/Random.h"
|
||||||
#include "core/FilePath.h"
|
#include "core/FilePath.h"
|
||||||
|
|
||||||
|
const QString PassphraseGenerator::DefaultSeparator = " ";
|
||||||
|
const QString PassphraseGenerator::DefaultWordList = "eff_large.wordlist";
|
||||||
|
|
||||||
PassphraseGenerator::PassphraseGenerator()
|
PassphraseGenerator::PassphraseGenerator()
|
||||||
: m_wordCount(0)
|
: m_wordCount(0)
|
||||||
, m_separator(' ')
|
, m_separator(PassphraseGenerator::DefaultSeparator)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -76,7 +79,7 @@ void PassphraseGenerator::setWordList(QString path)
|
|||||||
|
|
||||||
void PassphraseGenerator::setDefaultWordList()
|
void PassphraseGenerator::setDefaultWordList()
|
||||||
{
|
{
|
||||||
const QString path = filePath()->dataPath("wordlists/eff_large.wordlist");
|
const QString path = filePath()->wordlistPath(PassphraseGenerator::DefaultWordList);
|
||||||
setWordList(path);
|
setWordList(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,6 +37,8 @@ public:
|
|||||||
QString generatePassphrase() const;
|
QString generatePassphrase() const;
|
||||||
|
|
||||||
static const int DefaultWordCount = 7;
|
static const int DefaultWordCount = 7;
|
||||||
|
static const QString DefaultSeparator;
|
||||||
|
static const QString DefaultWordList;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int m_wordCount;
|
int m_wordCount;
|
||||||
|
@ -42,7 +42,8 @@ public:
|
|||||||
enum GeneratorFlag
|
enum GeneratorFlag
|
||||||
{
|
{
|
||||||
ExcludeLookAlike = 0x1,
|
ExcludeLookAlike = 0x1,
|
||||||
CharFromEveryGroup = 0x2
|
CharFromEveryGroup = 0x2,
|
||||||
|
DefaultFlags = ExcludeLookAlike | CharFromEveryGroup
|
||||||
};
|
};
|
||||||
Q_DECLARE_FLAGS(GeneratorFlags, GeneratorFlag)
|
Q_DECLARE_FLAGS(GeneratorFlags, GeneratorFlag)
|
||||||
|
|
||||||
@ -60,6 +61,13 @@ public:
|
|||||||
int getbits() const;
|
int getbits() const;
|
||||||
|
|
||||||
static const int DefaultLength = 16;
|
static const int DefaultLength = 16;
|
||||||
|
static const bool DefaultLower = (DefaultCharset & LowerLetters) != 0;
|
||||||
|
static const bool DefaultUpper = (DefaultCharset & UpperLetters) != 0;
|
||||||
|
static const bool DefaultNumbers = (DefaultCharset & Numbers) != 0;
|
||||||
|
static const bool DefaultSpecial = (DefaultCharset & SpecialCharacters) != 0;
|
||||||
|
static const bool DefaultEASCII = (DefaultCharset & EASCII) != 0;
|
||||||
|
static const bool DefaultLookAlike = (DefaultFlags & ExcludeLookAlike) != 0;
|
||||||
|
static const bool DefaultFromEveryGroup = (DefaultFlags & CharFromEveryGroup) != 0;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QVector<PasswordGroup> passwordGroups() const;
|
QVector<PasswordGroup> passwordGroups() const;
|
||||||
|
@ -68,9 +68,9 @@ PasswordGeneratorWidget::PasswordGeneratorWidget(QWidget* parent)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// set default separator to Space
|
// set default separator to Space
|
||||||
m_ui->editWordSeparator->setText(" ");
|
m_ui->editWordSeparator->setText(PassphraseGenerator::DefaultSeparator);
|
||||||
|
|
||||||
QDir path(filePath()->dataPath("wordlists/"));
|
QDir path(filePath()->wordlistPath(""));
|
||||||
QStringList files = path.entryList(QDir::Files);
|
QStringList files = path.entryList(QDir::Files);
|
||||||
m_ui->comboBoxWordList->addItems(files);
|
m_ui->comboBoxWordList->addItems(files);
|
||||||
if (files.size() > 1) {
|
if (files.size() > 1) {
|
||||||
@ -93,19 +93,19 @@ PasswordGeneratorWidget::~PasswordGeneratorWidget()
|
|||||||
void PasswordGeneratorWidget::loadSettings()
|
void PasswordGeneratorWidget::loadSettings()
|
||||||
{
|
{
|
||||||
// Password config
|
// Password config
|
||||||
m_ui->checkBoxLower->setChecked(config()->get("generator/LowerCase", true).toBool());
|
m_ui->checkBoxLower->setChecked(config()->get("generator/LowerCase", PasswordGenerator::DefaultLower).toBool());
|
||||||
m_ui->checkBoxUpper->setChecked(config()->get("generator/UpperCase", true).toBool());
|
m_ui->checkBoxUpper->setChecked(config()->get("generator/UpperCase", PasswordGenerator::DefaultUpper).toBool());
|
||||||
m_ui->checkBoxNumbers->setChecked(config()->get("generator/Numbers", true).toBool());
|
m_ui->checkBoxNumbers->setChecked(config()->get("generator/Numbers", PasswordGenerator::DefaultNumbers).toBool());
|
||||||
m_ui->checkBoxSpecialChars->setChecked(config()->get("generator/SpecialChars", false).toBool());
|
m_ui->checkBoxSpecialChars->setChecked(config()->get("generator/SpecialChars", PasswordGenerator::DefaultSpecial).toBool());
|
||||||
m_ui->checkBoxExtASCII->setChecked(config()->get("generator/EASCII", false).toBool());
|
m_ui->checkBoxExtASCII->setChecked(config()->get("generator/EASCII", PasswordGenerator::DefaultEASCII).toBool());
|
||||||
m_ui->checkBoxExcludeAlike->setChecked(config()->get("generator/ExcludeAlike", true).toBool());
|
m_ui->checkBoxExcludeAlike->setChecked(config()->get("generator/ExcludeAlike", PasswordGenerator::DefaultLookAlike).toBool());
|
||||||
m_ui->checkBoxEnsureEvery->setChecked(config()->get("generator/EnsureEvery", true).toBool());
|
m_ui->checkBoxEnsureEvery->setChecked(config()->get("generator/EnsureEvery", PasswordGenerator::DefaultFromEveryGroup).toBool());
|
||||||
m_ui->spinBoxLength->setValue(config()->get("generator/Length", PasswordGenerator::DefaultLength).toInt());
|
m_ui->spinBoxLength->setValue(config()->get("generator/Length", PasswordGenerator::DefaultLength).toInt());
|
||||||
|
|
||||||
// Diceware config
|
// Diceware config
|
||||||
m_ui->spinBoxWordCount->setValue(config()->get("generator/WordCount", 6).toInt());
|
m_ui->spinBoxWordCount->setValue(config()->get("generator/WordCount", PassphraseGenerator::DefaultWordCount).toInt());
|
||||||
m_ui->editWordSeparator->setText(config()->get("generator/WordSeparator", " ").toString());
|
m_ui->editWordSeparator->setText(config()->get("generator/WordSeparator", PassphraseGenerator::DefaultSeparator).toString());
|
||||||
m_ui->comboBoxWordList->setCurrentText(config()->get("generator/WordList", "eff_large.wordlist").toString());
|
m_ui->comboBoxWordList->setCurrentText(config()->get("generator/WordList", PassphraseGenerator::DefaultWordList).toString());
|
||||||
|
|
||||||
// Password or diceware?
|
// Password or diceware?
|
||||||
m_ui->tabWidget->setCurrentIndex(config()->get("generator/Type", 0).toInt());
|
m_ui->tabWidget->setCurrentIndex(config()->get("generator/Type", 0).toInt());
|
||||||
@ -394,7 +394,7 @@ void PasswordGeneratorWidget::updateGenerator()
|
|||||||
|
|
||||||
m_dicewareGenerator->setWordCount(m_ui->spinBoxWordCount->value());
|
m_dicewareGenerator->setWordCount(m_ui->spinBoxWordCount->value());
|
||||||
if (!m_ui->comboBoxWordList->currentText().isEmpty()) {
|
if (!m_ui->comboBoxWordList->currentText().isEmpty()) {
|
||||||
QString path = filePath()->dataPath("wordlists/" + m_ui->comboBoxWordList->currentText());
|
QString path = filePath()->wordlistPath(m_ui->comboBoxWordList->currentText());
|
||||||
m_dicewareGenerator->setWordList(path);
|
m_dicewareGenerator->setWordList(path);
|
||||||
}
|
}
|
||||||
m_dicewareGenerator->setWordSeparator(m_ui->editWordSeparator->text());
|
m_dicewareGenerator->setWordSeparator(m_ui->editWordSeparator->text());
|
||||||
|
@ -48,13 +48,14 @@ HttpPasswordGeneratorWidget::~HttpPasswordGeneratorWidget()
|
|||||||
|
|
||||||
void HttpPasswordGeneratorWidget::loadSettings()
|
void HttpPasswordGeneratorWidget::loadSettings()
|
||||||
{
|
{
|
||||||
m_ui->checkBoxLower->setChecked(config()->get("Http/generator/LowerCase", true).toBool());
|
m_ui->checkBoxLower->setChecked(config()->get("Http/generator/LowerCase", PasswordGenerator::DefaultLower).toBool());
|
||||||
m_ui->checkBoxUpper->setChecked(config()->get("Http/generator/UpperCase", true).toBool());
|
m_ui->checkBoxUpper->setChecked(config()->get("Http/generator/UpperCase", PasswordGenerator::DefaultUpper).toBool());
|
||||||
m_ui->checkBoxNumbers->setChecked(config()->get("Http/generator/Numbers", true).toBool());
|
m_ui->checkBoxNumbers->setChecked(config()->get("Http/generator/Numbers", PasswordGenerator::DefaultNumbers).toBool());
|
||||||
m_ui->checkBoxSpecialChars->setChecked(config()->get("Http/generator/SpecialChars", false).toBool());
|
m_ui->checkBoxSpecialChars->setChecked(config()->get("Http/generator/SpecialChars", PasswordGenerator::DefaultSpecial).toBool());
|
||||||
|
m_ui->checkBoxSpecialChars->setChecked(config()->get("Http/generator/EASCII", PasswordGenerator::DefaultEASCII).toBool());
|
||||||
|
|
||||||
m_ui->checkBoxExcludeAlike->setChecked(config()->get("Http/generator/ExcludeAlike", true).toBool());
|
m_ui->checkBoxExcludeAlike->setChecked(config()->get("Http/generator/ExcludeAlike", PasswordGenerator::DefaultLookAlike).toBool());
|
||||||
m_ui->checkBoxEnsureEvery->setChecked(config()->get("Http/generator/EnsureEvery", true).toBool());
|
m_ui->checkBoxEnsureEvery->setChecked(config()->get("Http/generator/EnsureEvery", PasswordGenerator::DefaultFromEveryGroup).toBool());
|
||||||
|
|
||||||
m_ui->spinBoxLength->setValue(config()->get("Http/generator/Length", PasswordGenerator::DefaultLength).toInt());
|
m_ui->spinBoxLength->setValue(config()->get("Http/generator/Length", PasswordGenerator::DefaultLength).toInt());
|
||||||
}
|
}
|
||||||
@ -65,6 +66,7 @@ void HttpPasswordGeneratorWidget::saveSettings()
|
|||||||
config()->set("Http/generator/UpperCase", m_ui->checkBoxUpper->isChecked());
|
config()->set("Http/generator/UpperCase", m_ui->checkBoxUpper->isChecked());
|
||||||
config()->set("Http/generator/Numbers", m_ui->checkBoxNumbers->isChecked());
|
config()->set("Http/generator/Numbers", m_ui->checkBoxNumbers->isChecked());
|
||||||
config()->set("Http/generator/SpecialChars", m_ui->checkBoxSpecialChars->isChecked());
|
config()->set("Http/generator/SpecialChars", m_ui->checkBoxSpecialChars->isChecked());
|
||||||
|
config()->set("Http/generator/EASCII", m_ui->checkBoxExtASCII->isChecked());
|
||||||
|
|
||||||
config()->set("Http/generator/ExcludeAlike", m_ui->checkBoxExcludeAlike->isChecked());
|
config()->set("Http/generator/ExcludeAlike", m_ui->checkBoxExcludeAlike->isChecked());
|
||||||
config()->set("Http/generator/EnsureEvery", m_ui->checkBoxEnsureEvery->isChecked());
|
config()->set("Http/generator/EnsureEvery", m_ui->checkBoxEnsureEvery->isChecked());
|
||||||
@ -120,6 +122,10 @@ PasswordGenerator::CharClasses HttpPasswordGeneratorWidget::charClasses()
|
|||||||
classes |= PasswordGenerator::SpecialCharacters;
|
classes |= PasswordGenerator::SpecialCharacters;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_ui->checkBoxExtASCII->isChecked()) {
|
||||||
|
classes |= PasswordGenerator::EASCII;
|
||||||
|
}
|
||||||
|
|
||||||
return classes;
|
return classes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -142,6 +142,22 @@
|
|||||||
</attribute>
|
</attribute>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QToolButton" name="checkBoxExtASCII">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Extended ASCII</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Extended ASCII</string>
|
||||||
|
</property>
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<attribute name="buttonGroup">
|
||||||
|
<string notr="true">optionButtons</string>
|
||||||
|
</attribute>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="horizontalSpacer">
|
<spacer name="horizontalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
|
@ -145,7 +145,7 @@ void HttpSettings::setHttpPort(int port)
|
|||||||
|
|
||||||
bool HttpSettings::passwordUseNumbers()
|
bool HttpSettings::passwordUseNumbers()
|
||||||
{
|
{
|
||||||
return config()->get("Http/generator/Numbers", true).toBool();
|
return config()->get("Http/generator/Numbers", PasswordGenerator::DefaultNumbers).toBool();
|
||||||
}
|
}
|
||||||
|
|
||||||
void HttpSettings::setPasswordUseNumbers(bool useNumbers)
|
void HttpSettings::setPasswordUseNumbers(bool useNumbers)
|
||||||
@ -155,7 +155,7 @@ void HttpSettings::setPasswordUseNumbers(bool useNumbers)
|
|||||||
|
|
||||||
bool HttpSettings::passwordUseLowercase()
|
bool HttpSettings::passwordUseLowercase()
|
||||||
{
|
{
|
||||||
return config()->get("Http/generator/LowerCase", true).toBool();
|
return config()->get("Http/generator/LowerCase", PasswordGenerator::DefaultLower).toBool();
|
||||||
}
|
}
|
||||||
|
|
||||||
void HttpSettings::setPasswordUseLowercase(bool useLowercase)
|
void HttpSettings::setPasswordUseLowercase(bool useLowercase)
|
||||||
@ -165,7 +165,7 @@ void HttpSettings::setPasswordUseLowercase(bool useLowercase)
|
|||||||
|
|
||||||
bool HttpSettings::passwordUseUppercase()
|
bool HttpSettings::passwordUseUppercase()
|
||||||
{
|
{
|
||||||
return config()->get("Http/generator/UpperCase", true).toBool();
|
return config()->get("Http/generator/UpperCase", PasswordGenerator::DefaultUpper).toBool();
|
||||||
}
|
}
|
||||||
|
|
||||||
void HttpSettings::setPasswordUseUppercase(bool useUppercase)
|
void HttpSettings::setPasswordUseUppercase(bool useUppercase)
|
||||||
@ -175,7 +175,7 @@ void HttpSettings::setPasswordUseUppercase(bool useUppercase)
|
|||||||
|
|
||||||
bool HttpSettings::passwordUseSpecial()
|
bool HttpSettings::passwordUseSpecial()
|
||||||
{
|
{
|
||||||
return config()->get("Http/generator/SpecialChars", false).toBool();
|
return config()->get("Http/generator/SpecialChars", PasswordGenerator::DefaultSpecial).toBool();
|
||||||
}
|
}
|
||||||
|
|
||||||
void HttpSettings::setPasswordUseSpecial(bool useSpecial)
|
void HttpSettings::setPasswordUseSpecial(bool useSpecial)
|
||||||
@ -183,9 +183,19 @@ void HttpSettings::setPasswordUseSpecial(bool useSpecial)
|
|||||||
config()->set("Http/generator/SpecialChars", useSpecial);
|
config()->set("Http/generator/SpecialChars", useSpecial);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool HttpSettings::passwordUseEASCII()
|
||||||
|
{
|
||||||
|
return config()->get("Http/generator/EASCII", PasswordGenerator::DefaultEASCII).toBool();
|
||||||
|
}
|
||||||
|
|
||||||
|
void HttpSettings::setPasswordUseEASCII(bool useExtended)
|
||||||
|
{
|
||||||
|
config()->set("Http/generator/EASCII", useExtended);
|
||||||
|
}
|
||||||
|
|
||||||
bool HttpSettings::passwordEveryGroup()
|
bool HttpSettings::passwordEveryGroup()
|
||||||
{
|
{
|
||||||
return config()->get("Http/generator/EnsureEvery", true).toBool();
|
return config()->get("Http/generator/EnsureEvery", PasswordGenerator::DefaultFromEveryGroup).toBool();
|
||||||
}
|
}
|
||||||
|
|
||||||
void HttpSettings::setPasswordEveryGroup(bool everyGroup)
|
void HttpSettings::setPasswordEveryGroup(bool everyGroup)
|
||||||
@ -195,7 +205,7 @@ void HttpSettings::setPasswordEveryGroup(bool everyGroup)
|
|||||||
|
|
||||||
bool HttpSettings::passwordExcludeAlike()
|
bool HttpSettings::passwordExcludeAlike()
|
||||||
{
|
{
|
||||||
return config()->get("Http/generator/ExcludeAlike", true).toBool();
|
return config()->get("Http/generator/ExcludeAlike", PasswordGenerator::DefaultLookAlike).toBool();
|
||||||
}
|
}
|
||||||
|
|
||||||
void HttpSettings::setPasswordExcludeAlike(bool excludeAlike)
|
void HttpSettings::setPasswordExcludeAlike(bool excludeAlike)
|
||||||
@ -205,7 +215,7 @@ void HttpSettings::setPasswordExcludeAlike(bool excludeAlike)
|
|||||||
|
|
||||||
int HttpSettings::passwordLength()
|
int HttpSettings::passwordLength()
|
||||||
{
|
{
|
||||||
return config()->get("Http/generator/Length", 20).toInt();
|
return config()->get("Http/generator/Length", PasswordGenerator::DefaultLength).toInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
void HttpSettings::setPasswordLength(int length)
|
void HttpSettings::setPasswordLength(int length)
|
||||||
@ -217,14 +227,21 @@ void HttpSettings::setPasswordLength(int length)
|
|||||||
PasswordGenerator::CharClasses HttpSettings::passwordCharClasses()
|
PasswordGenerator::CharClasses HttpSettings::passwordCharClasses()
|
||||||
{
|
{
|
||||||
PasswordGenerator::CharClasses classes;
|
PasswordGenerator::CharClasses classes;
|
||||||
if (passwordUseLowercase())
|
if (passwordUseLowercase()) {
|
||||||
classes |= PasswordGenerator::LowerLetters;
|
classes |= PasswordGenerator::LowerLetters;
|
||||||
if (passwordUseUppercase())
|
}
|
||||||
|
if (passwordUseUppercase()) {
|
||||||
classes |= PasswordGenerator::UpperLetters;
|
classes |= PasswordGenerator::UpperLetters;
|
||||||
if (passwordUseNumbers())
|
}
|
||||||
|
if (passwordUseNumbers()) {
|
||||||
classes |= PasswordGenerator::Numbers;
|
classes |= PasswordGenerator::Numbers;
|
||||||
if (passwordUseSpecial())
|
}
|
||||||
|
if (passwordUseSpecial()) {
|
||||||
classes |= PasswordGenerator::SpecialCharacters;
|
classes |= PasswordGenerator::SpecialCharacters;
|
||||||
|
}
|
||||||
|
if (passwordUseEASCII()) {
|
||||||
|
classes |= PasswordGenerator::EASCII;
|
||||||
|
}
|
||||||
return classes;
|
return classes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,6 +58,8 @@ public:
|
|||||||
static void setPasswordUseUppercase(bool useUppercase);
|
static void setPasswordUseUppercase(bool useUppercase);
|
||||||
static bool passwordUseSpecial();
|
static bool passwordUseSpecial();
|
||||||
static void setPasswordUseSpecial(bool useSpecial);
|
static void setPasswordUseSpecial(bool useSpecial);
|
||||||
|
static bool passwordUseEASCII();
|
||||||
|
static void setPasswordUseEASCII(bool useExtended);
|
||||||
static bool passwordEveryGroup();
|
static bool passwordEveryGroup();
|
||||||
static void setPasswordEveryGroup(bool everyGroup);
|
static void setPasswordEveryGroup(bool everyGroup);
|
||||||
static bool passwordExcludeAlike();
|
static bool passwordExcludeAlike();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user