-Subproject commit 18bdad879d9f25f35f065354aedf1236e6b0a60b
+Subproject commit 57e241748fb8caec0033f84cb14ef7861132c4e6
}
void MainWindow::updatePasswordIcon() {
- QIcon icon = m_ctx->wallet->getPassword().isEmpty() ? icons()->icon("unlock.svg") : icons()->icon("lock.svg");
+ bool emptyPassword = m_ctx->wallet->verifyPassword("");
+ QIcon icon = emptyPassword ? icons()->icon("unlock.svg") : icons()->icon("lock.svg");
m_statusBtnPassword->setIcon(icon);
}
if (ret == QDialog::Rejected) {
return false;
}
- if (passwordDialog.password != m_ctx->wallet->getPassword()) {
+
+ if (!m_ctx->wallet->verifyPassword(passwordDialog.password)) {
incorrectPassword = true;
continue;
}
return;
}
- if (password != m_ctx->wallet->getPassword()) {
+ if (!m_ctx->wallet->verifyPassword(password)) {
m_walletUnlockWidget->incorrectPassword();
return;
}
{
ui->setupUi(this);
- bool noPassword = wallet->getPassword().isEmpty();
-
+ bool noPassword = wallet->verifyPassword("");
QString warning_str = noPassword ? "Your wallet is not password protected. Use this dialog to add a password to your wallet." :
"Your wallet is password protected and encrypted. Use this dialog to change your password.";
ui->label_warning->setText(warning_str);
QString currentPassword = ui->lineEdit_currentPassword->text();
QString newPassword = ui->lineEdit_newPassword->text();
- if (currentPassword != m_wallet->getPassword()) {
+ if (!m_wallet->verifyPassword(currentPassword)) {
QMessageBox::warning(this, "Error", "Incorrect password");
ui->lineEdit_currentPassword->setText("");
ui->lineEdit_currentPassword->setFocus();
return;
}
- if (m_wallet->setPassword(newPassword)) {
+ if (m_wallet->setPassword(currentPassword, newPassword)) {
QMessageBox::information(this, "Information", "Password changed successfully");
this->accept();
}
return QString::fromStdString(m_walletImpl->errorString());
}
-bool Wallet::setPassword(const QString &password)
+bool Wallet::setPassword(const QString &oldPassword, const QString &newPassword)
{
- return m_walletImpl->setPassword(password.toStdString());
+ return m_walletImpl->setPassword(oldPassword.toStdString(), newPassword.toStdString());
}
-QString Wallet::getPassword()
+bool Wallet::verifyPassword(const QString &password)
{
- return QString::fromStdString(m_walletImpl->getPassword());
+ return m_walletImpl->verifyPassword(password.toStdString());
}
QString Wallet::address(quint32 accountIndex, quint32 addressIndex) const
return QDir::toNativeSeparators(QString::fromStdString(m_walletImpl->keysFilename()));;
}
-void Wallet::store(const QString &path)
+void Wallet::store()
{
- m_walletImpl->store(path.toStdString());
+ m_walletImpl->store();
}
bool Wallet::init(const QString &daemonAddress, bool trustedDaemon, quint64 upperTransactionLimit, bool isRecovering, bool isRecoveringFromDevice, quint64 restoreHeight, const QString& proxyAddress)
//Monero::WalletManagerFactory::getWalletManager()->closeWallet(m_walletImpl);
if(status() == Status_Critical || status() == Status_BadPassword)
qDebug("Not storing wallet cache");
- else if( m_walletImpl->store(""))
+ else if( m_walletImpl->store())
qDebug("Wallet cache stored successfully");
else
qDebug("Error storing wallet cache");
QString errorString() const;
//! changes the password using existing parameters (path, seed, seed lang)
- bool setPassword(const QString &password);
+ bool setPassword(const QString &oldPassword, const QString &newPassword);
- //! get current wallet password
- QString getPassword();
+ //! verify wallet password
+ bool verifyPassword(const QString &password);
//! returns wallet's public address
QString address(quint32 accountIndex, quint32 addressIndex) const;
//! saves wallet to the file by given path
//! empty path stores in current location
- void store(const QString &path = "");
+ void store();
// void storeAsync(const QJSValue &callback, const QString &path = "");
//! initializes wallet asynchronously