0
0
Fork 0
mirror of https://github.com/bitcoin/bitcoin.git synced 2025-02-08 10:31:50 -05:00

Merge bitcoin-core/gui#722: wallet: Allow user to navigate options while encrypting at creation

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

Pull request description:

  This fixes https://github.com/bitcoin-core/gui/issues/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 cccddc03f0
  BrandonOdiwuor:
    re-Tested ACK cccddc03f0
  hebasto:
    ACK cccddc03f0, tested on Ubuntu 24.04.

Tree-SHA512: d2856d75f75acbd7d51ede62b4abd317f6ed6a9b890fe0b73b63b921b4b3d61b49477e35dc74466a056a9e8c0c1598df7601111d36c57ef18fdfdf0b18f503e6
This commit is contained in:
merge-script 2024-05-15 18:41:15 +01:00
commit 7a40f2a3f1
No known key found for this signature in database
GPG key ID: 410108112E7EA81F

View file

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