Disallow empty passwords.

This commit is contained in:
clemahieu 2017-04-16 12:50:28 -05:00
commit 265521c15c

View file

@ -1105,17 +1105,27 @@ wallet (wallet_a)
rai::transaction transaction (this->wallet.wallet_m->store.environment, nullptr, true); rai::transaction transaction (this->wallet.wallet_m->store.environment, nullptr, true);
if (this->wallet.wallet_m->store.valid_password (transaction)) 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 (); new_password->clear ();
retype_password->clear (); new_password->setPlaceholderText ("Empty Password - try again: New password");
retype_password->setPlaceholderText ("Retype password"); retype_password->clear ();
retype_password->setPlaceholderText ("Empty Password - try again: Retype password");
} }
else else
{ {
retype_password->clear (); if (new_password->text () == retype_password->text ())
retype_password->setPlaceholderText ("Password mismatch"); {
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");
}
} }
} }
}); });