Skip to content

Commit

Permalink
Merge bitcoin-core/gui#722: wallet: Allow user to navigate options wh…
Browse files Browse the repository at this point in the history
…ile encrypting at creation

cccddc0 Wallet encrypt on create, allow to navigate options (Hernan Marino)

Pull request description:

  This fixes bitcoin-core/gui#394.
  It adds a  "Go back" button to the "Confirm wallet encryption" window, allowing the users to change the password if they want to. It also adds a Cancel button to the "Wallet to be encrypted" window.
  Prior to this change users had no option to alter the password, and were forced to either go ahead with wallet creation or cancel the whole process. Also, at the final window, they were shown a warning but with no option to cancel.
  The new workflow for wallet encryption and creation is similar to the following:

  ![videoNavigation](https://user-images.githubusercontent.com/87907936/225705434-22d3c678-fa01-4079-ba10-ca5a0e8d3922.gif)

ACKs for top commit:
  alfonsoromanz:
    Re-Tested ACK bitcoin-core/gui@cccddc0
  BrandonOdiwuor:
    re-Tested ACK cccddc0
  hebasto:
    ACK cccddc0, tested on Ubuntu 24.04.

Tree-SHA512: d2856d75f75acbd7d51ede62b4abd317f6ed6a9b890fe0b73b63b921b4b3d61b49477e35dc74466a056a9e8c0c1598df7601111d36c57ef18fdfdf0b18f503e6
  • Loading branch information
hebasto committed May 15, 2024
2 parents 33303b2 + cccddc0 commit 7a40f2a
Showing 1 changed file with 22 additions and 13 deletions.
35 changes: 22 additions & 13 deletions src/qt/askpassphrasedialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,14 @@ void AskPassphraseDialog::accept()
// Cannot encrypt with empty passphrase
break;
}
QMessageBox::StandardButton retval = QMessageBox::question(this, tr("Confirm wallet encryption"),
tr("Warning: If you encrypt your wallet and lose your passphrase, you will <b>LOSE ALL OF YOUR BITCOINS</b>!") + "<br><br>" + tr("Are you sure you wish to encrypt your wallet?"),
QMessageBox::Yes|QMessageBox::Cancel,
QMessageBox::Cancel);
QMessageBox msgBoxConfirm(QMessageBox::Question,
tr("Confirm wallet encryption"),
tr("Warning: If you encrypt your wallet and lose your passphrase, you will <b>LOSE ALL OF YOUR BITCOINS</b>!") + "<br><br>" + tr("Are you sure you wish to encrypt your wallet?"),
QMessageBox::Cancel | QMessageBox::Yes, this);
msgBoxConfirm.button(QMessageBox::Yes)->setText(tr("Continue"));
msgBoxConfirm.button(QMessageBox::Cancel)->setText(tr("Back"));
msgBoxConfirm.setDefaultButton(QMessageBox::Cancel);
QMessageBox::StandardButton retval = (QMessageBox::StandardButton)msgBoxConfirm.exec();
if(retval == QMessageBox::Yes)
{
if(newpass1 == newpass2)
Expand All @@ -112,10 +116,19 @@ void AskPassphraseDialog::accept()
"your bitcoins from being stolen by malware infecting your computer.");
if (m_passphrase_out) {
m_passphrase_out->assign(newpass1);
QMessageBox::warning(this, tr("Wallet to be encrypted"),
"<qt>" +
tr("Your wallet is about to be encrypted. ") + encryption_reminder +
"</b></qt>");
QMessageBox msgBoxWarning(QMessageBox::Warning,
tr("Wallet to be encrypted"),
"<qt>" +
tr("Your wallet is about to be encrypted. ") + encryption_reminder + " " +
tr("Are you sure you wish to encrypt your wallet?") +
"</b></qt>",
QMessageBox::Cancel | QMessageBox::Yes, this);
msgBoxWarning.setDefaultButton(QMessageBox::Cancel);
QMessageBox::StandardButton retval = (QMessageBox::StandardButton)msgBoxWarning.exec();
if (retval == QMessageBox::Cancel) {
QDialog::reject();
return;
}
} else {
assert(model != nullptr);
if (model->setWalletEncrypted(newpass1)) {
Expand All @@ -141,11 +154,7 @@ void AskPassphraseDialog::accept()
tr("The supplied passphrases do not match."));
}
}
else
{
QDialog::reject(); // Cancelled
}
} break;
} break;
case Unlock:
try {
if (!model->setWalletLocked(false, oldpass)) {
Expand Down

0 comments on commit 7a40f2a

Please sign in to comment.