summaryrefslogtreecommitdiffstats
path: root/mainwindow.cpp
diff options
context:
space:
mode:
authorAndrey Mazo <brouwer@annejan.com>2016-03-01 00:30:51 -0500
committerAndrey Mazo <ahippo@yandex.com>2016-03-06 23:57:29 +0300
commit1fce33ff508c0d083afeafc58e3894233ae87979 (patch)
tree0fc1b3ab6d57f065bee96ca9ca413f1472e7d55b /mainwindow.cpp
parent9c61978d503263a1f60c630b45f7336a695692b6 (diff)
Use --secure for pwgen and add more configurable options
Enable --secure option for pwgen by default as it allows it to generate more random passwords. Also, add the following options to pwgen together with corresponding checkboxes: * --capitalize * --numerals * --secure All these options are enabled by default, as * we're a password manager, so no need to memorize passwords, so we should make them more secure by default; * most websites accept passwords, generated using these options (unlike --symbols option) Convert horizontal layout for options into form layout to accommodate more checkboxes.
Diffstat (limited to 'mainwindow.cpp')
-rw-r--r--mainwindow.cpp19
1 files changed, 18 insertions, 1 deletions
diff --git a/mainwindow.cpp b/mainwindow.cpp
index 7dee65fd..4a71ca73 100644
--- a/mainwindow.cpp
+++ b/mainwindow.cpp
@@ -260,6 +260,9 @@ bool MainWindow::checkConfig() {
useGit = (settings.value("useGit") == "true");
usePwgen = (settings.value("usePwgen") == "true");
+ avoidCapitals = settings.value("avoidCapitals").toBool();
+ avoidNumbers = settings.value("avoidNumbers").toBool();
+ lessRandom = settings.value("lessRandom").toBool();
useSymbols = (settings.value("useSymbols") == "true");
passwordLength = settings.value("passwordLength").toInt();
passwordChars = settings.value("passwordChars").toString();
@@ -431,6 +434,9 @@ void MainWindow::config() {
d->useGit(useGit);
d->setPwgenPath(pwgenExecutable);
d->usePwgen(usePwgen);
+ d->avoidCapitals(avoidCapitals);
+ d->avoidNumbers(avoidNumbers);
+ d->lessRandom(lessRandom);
d->useSymbols(useSymbols);
d->setPasswordLength(passwordLength);
d->setPasswordChars(passwordChars);
@@ -464,6 +470,9 @@ void MainWindow::config() {
useGit = d->useGit();
pwgenExecutable = d->getPwgenPath();
usePwgen = d->usePwgen();
+ avoidCapitals = d->avoidCapitals();
+ avoidNumbers = d->avoidNumbers();
+ lessRandom = d->lessRandom();
useSymbols = d->useSymbols();
passwordLength = d->getPasswordLength();
passwordChars = d->getPasswordChars();
@@ -507,6 +516,9 @@ void MainWindow::config() {
settings.setValue("useGit", useGit ? "true" : "false");
settings.setValue("pwgenExecutable", pwgenExecutable);
settings.setValue("usePwgen", usePwgen ? "true" : "false");
+ settings.setValue("avoidCapitals", avoidCapitals ? "true" : "false");
+ settings.setValue("avoidNumbers", avoidNumbers ? "true" : "false");
+ settings.setValue("lessRandom", lessRandom ? "true" : "false");
settings.setValue("useSymbols", useSymbols ? "true" : "false");
settings.setValue("passwordLength", passwordLength);
settings.setValue("passwordChars", passwordChars);
@@ -1752,7 +1764,12 @@ QString MainWindow::generatePassword() {
QString passwd;
if (usePwgen) {
waitFor(2);
- QString args = (useSymbols ? "--symbols -1 " : "-1 ") +
+ // --secure goes first as it overrides --no-* otherwise
+ QString args = QString("-1 ") +
+ (lessRandom ? "" : "--secure ") +
+ (avoidCapitals ? "--no-capitalize " : "--capitalize ") +
+ (avoidNumbers ? "--no-numerals " : "--numerals ") +
+ (useSymbols ? "--symbols " : "") +
QString::number(passwordLength);
currentAction = PWGEN;
executeWrapper(pwgenExecutable, args);