Handle blank passwords/cancel.

Fixes #10
This commit is contained in:
Aditya Kulkarni
2019-10-31 09:55:48 -07:00
parent 58c80aaf81
commit 0a99730fba
2 changed files with 18 additions and 1 deletions

View File

@@ -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)) {