From 265521c15cfe354d05ecc24cd55c4f094c063981 Mon Sep 17 00:00:00 2001 From: clemahieu Date: Sun, 16 Apr 2017 12:50:28 -0500 Subject: [PATCH] Disallow empty passwords. --- rai/qt/qt.cpp | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/rai/qt/qt.cpp b/rai/qt/qt.cpp index 5bcb6fc1..359b1f1a 100644 --- a/rai/qt/qt.cpp +++ b/rai/qt/qt.cpp @@ -1105,17 +1105,27 @@ wallet (wallet_a) rai::transaction transaction (this->wallet.wallet_m->store.environment, nullptr, true); if (this->wallet.wallet_m->store.valid_password (transaction)) { - if (new_password->text () == retype_password->text ()) + if (new_password->text ().isEmpty()) { - this->wallet.wallet_m->store.rekey (transaction, std::string (new_password->text ().toLocal8Bit ())); new_password->clear (); - retype_password->clear (); - retype_password->setPlaceholderText ("Retype password"); + new_password->setPlaceholderText ("Empty Password - try again: New password"); + retype_password->clear (); + retype_password->setPlaceholderText ("Empty Password - try again: Retype password"); } else { - retype_password->clear (); - retype_password->setPlaceholderText ("Password mismatch"); + if (new_password->text () == retype_password->text ()) + { + this->wallet.wallet_m->store.rekey (transaction, std::string (new_password->text ().toLocal8Bit ())); + new_password->clear (); + retype_password->clear (); + retype_password->setPlaceholderText ("Retype password"); + } + else + { + retype_password->clear (); + retype_password->setPlaceholderText ("Password mismatch"); + } } } });