2 #include "ui_encryptdialog.h"
12 QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint),
17 connect(
ui->linePwd, SIGNAL(textChanged(
const QString &)),
this, SLOT(
validateNewPass()));
20 connect(
ui->btnCancel, SIGNAL(clicked()),
this, SLOT(
on_btnCancel()));
36 QMessageBox::StandardButton reply;
37 reply = QMessageBox::warning(
this,
"Wallet Encryption Required",
"There was no passphrase entered for the wallet.\n\nWallet encryption is required for the security of your funds.\n\nWhat would you like to do?", QMessageBox::Retry|QMessageBox::Close);
38 if (reply == QMessageBox::Retry) {
47 QMessageBox::StandardButton reply;
48 reply = QMessageBox::warning(
this,
"Wallet Encryption Required",
"There was no passphrase entered for the wallet.\n\nWallet encryption is required for the security of your funds.\n\nWhat would you like to do?", QMessageBox::Retry|QMessageBox::Close);
49 if (reply == QMessageBox::Retry) {
58 newPass.reserve(MAX_PASSPHRASE_SIZE);
59 newPass.assign(
ui->linePwd->text().toStdString().c_str() );
62 newPass2.reserve(MAX_PASSPHRASE_SIZE);
63 newPass2.assign(
ui->linePwdConfirm->text().toStdString().c_str() );
65 if ( (!
ui->linePwd->text().length()) || (!
ui->linePwdConfirm->text().length()) ) {
67 msgBox.setWindowTitle(
"Wallet Encryption Failed");
68 msgBox.setText(
"The passphrase entered for wallet encryption was empty. Please try again.");
70 msgBox.setIcon(QMessageBox::Critical);
75 if (newPass == newPass2) {
76 if (newPass.length() < 10) {
78 msgBox.setWindowTitle(
"Wallet Encryption Failed");
79 msgBox.setText(
"The passphrase's length has to be more than 10. Please try again.");
81 msgBox.setIcon(QMessageBox::Critical);
88 msgBox.setWindowTitle(
"Wallet Encryption Failed");
89 msgBox.setText(
"The passphrase must contain lower, upper, digit, symbol. Please try again.");
91 msgBox.setIcon(QMessageBox::Critical);
98 if (ret < 0 || guesses < 10000) {
100 msgBox.setWindowTitle(
"Wallet Encryption Failed");
101 msgBox.setText(
"The passphrases entered for wallet encryption is too weak. Please try again.");
103 msgBox.setIcon(QMessageBox::Critical);
112 msgBox.setWindowTitle(
"Wallet Encryption Successful");
113 msgBox.setText(
"Wallet passphrase was successfully set.\nPlease remember your passphrase as there is no way to recover it.");
115 msgBox.setIcon(QMessageBox::Information);
121 msgBox.setWindowTitle(
"Wallet Encryption Failed");
122 msgBox.setText(
"The passphrases entered for wallet encryption do not match. Please try again.");
124 msgBox.setIcon(QMessageBox::Critical);
132 if (!
ui->linePwd->text().length())
133 ui->linePwd->setStyleSheet(
"border-color: red");
136 ui->linePwd->repaint();
146 if (
ui->linePwd->text()==
ui->linePwdConfirm->text())
149 ui->linePwdConfirm->repaint();
153 ui->linePwdConfirm->setStyleSheet(
"border-color: red");
154 ui->linePwdConfirm->repaint();
161 ui->linePwd->setEchoMode(
ui->showPassphraseCheckBox->checkState() == Qt::Checked ? QLineEdit::Normal : QLineEdit::Password);
162 ui->linePwdConfirm->setEchoMode(
ui->showPassphraseCheckBox->checkState() == Qt::Checked ? QLineEdit::Normal : QLineEdit::Password);