From c12a4ffe73ba0969d23b412403709cb33ec14459 Mon Sep 17 00:00:00 2001 From: DenioD <41270280+DenioD@users.noreply.github.com> Date: Sun, 24 May 2020 09:39:50 +0200 Subject: [PATCH] use userpw for encryption at sdl close --- src/mainwindow.cpp | 15 ++++++++++++++- src/mainwindow.h | 3 +++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index fd5be39..5bb0740 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -276,7 +276,7 @@ void MainWindow::closeEvent(QCloseEvent* event) { fileoldencryption.remove(); // Encrypt our wallet.dat - QString str = "123";///just for testing. We set the user pw here + QString str = this->getPassword(); // QString str = ed.txtPassword->text(); // data comes from user inputs int length = str.length(); @@ -351,6 +351,7 @@ void MainWindow::encryptWallet() { auto fnPasswordEdited = [=](const QString&) { // Enable the OK button if the passwords match. QString password = ed.txtPassword->text(); + this->setPassword(password); if (!ed.txtPassword->text().isEmpty() && ed.txtPassword->text() == ed.txtConfirmPassword->text() && password.size() >= 16) { ed.lblPasswordMatch->setText(""); @@ -546,6 +547,18 @@ void MainWindow::removeWalletEncryptionStartUp() { } +QString MainWindow::getPassword() +{ + + return _password; +} + +void MainWindow::setPassword(QString password) +{ + + _password = password; +} + void MainWindow::setupStatusBar() { // Status Bar loadingLabel = new QLabel(); diff --git a/src/mainwindow.h b/src/mainwindow.h index 7384fc2..e80af01 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -51,6 +51,8 @@ public: QString doSendChatTxValidations(Tx tx); QString doSendRequestTxValidations(Tx tx); QString getCid(); + QString getPassword(); + void setPassword(QString Password); void replaceWormholeClient(WormholeClient* newClient); bool isWebsocketListening(); @@ -120,6 +122,7 @@ private: void setupStatusBar(); void clearSendForm(); + QString _password; Tx createTxFromSendPage(); bool confirmTx(Tx tx, RecurringPaymentInfo* rpi);