Browse Source

Handle blank passwords/cancel.

Fixes #10
pull/9/head
Aditya Kulkarni 5 years ago
parent
commit
0a99730fba
  1. 3
      src/controller.cpp
  2. 16
      src/mainwindow.cpp

3
src/controller.cpp

@ -462,6 +462,9 @@ void Controller::unlockIfEncrypted(std::function<void(void)> cb, std::function<v
zrpc->unlockWallet(password, [=](json reply) {
if (isJsonSuccess(reply)) {
cb();
// Refresh the wallet so the encryption status is now in sync.
refresh(true);
} else {
QMessageBox::critical(main, main->tr("Wallet Decryption Failed"),
QString::fromStdString(reply["error"].get<json::string_t>()),

16
src/mainwindow.cpp

@ -296,8 +296,22 @@ void MainWindow::removeWalletEncryption() {
return;
}
bool ok;
QString password = QInputDialog::getText(this, tr("Wallet Password"),
tr("Please enter your wallet password"), QLineEdit::Password);
tr("Please enter your wallet password"), QLineEdit::Password, "", &ok);
// If cancel was pressed, just return
if (!ok) {
return;
}
if (password.isEmpty()) {
QMessageBox::critical(this, tr("Wallet Decryption Failed"),
tr("Please enter a password to decrypt your wallet!"),
QMessageBox::Ok
);
return;
}
rpc->removeWalletEncryption(password, [=] (json res) {
if (isJsonSuccess(res)) {

Loading…
Cancel
Save