From efb7547a3b955d0f21fd3325b609400a6f13c6fb Mon Sep 17 00:00:00 2001 From: SergiySW Date: Fri, 30 Jun 2017 10:20:26 +0300 Subject: [PATCH] GUI: Password was changed notification --- rai/qt/qt.cpp | 63 ++++++++++++++++++++++++++++----------------------- 1 file changed, 35 insertions(+), 28 deletions(-) diff --git a/rai/qt/qt.cpp b/rai/qt/qt.cpp index d489997c..d2ac1ad2 100755 --- a/rai/qt/qt.cpp +++ b/rai/qt/qt.cpp @@ -1130,34 +1130,41 @@ wallet (wallet_a) layout->addStretch (); layout->addWidget (back); window->setLayout (layout); - QObject::connect (change, &QPushButton::released, [this] () - { + QObject::connect (change, &QPushButton::released, [this] () + { rai::transaction transaction (this->wallet.wallet_m->store.environment, nullptr, true); - if (this->wallet.wallet_m->store.valid_password (transaction)) - { - if (new_password->text ().isEmpty()) - { - new_password->clear (); - new_password->setPlaceholderText ("Empty Password - try again: New password"); - retype_password->clear (); - retype_password->setPlaceholderText ("Empty Password - try again: Retype password"); - } - else - { - if (new_password->text () == retype_password->text ()) - { - this->wallet.wallet_m->store.rekey (transaction, std::string (new_password->text ().toLocal8Bit ())); - new_password->clear (); - retype_password->clear (); - retype_password->setPlaceholderText ("Retype password"); - } - else - { - retype_password->clear (); - retype_password->setPlaceholderText ("Password mismatch"); - } - } - } + if (this->wallet.wallet_m->store.valid_password (transaction)) + { + if (new_password->text ().isEmpty()) + { + new_password->clear (); + new_password->setPlaceholderText ("Empty Password - try again: New password"); + retype_password->clear (); + retype_password->setPlaceholderText ("Empty Password - try again: Retype password"); + } + else + { + if (new_password->text () == retype_password->text ()) + { + this->wallet.wallet_m->store.rekey (transaction, std::string (new_password->text ().toLocal8Bit ())); + new_password->clear (); + retype_password->clear (); + retype_password->setPlaceholderText ("Retype password"); + show_button_success (*change); + change->setText ("Password was changed"); + this->wallet.node.alarm.add (std::chrono::system_clock::now () + std::chrono::seconds (5), [this] () + { + show_button_ok (*change); + change->setText ("Set/Change password"); + }); + } + else + { + retype_password->clear (); + retype_password->setPlaceholderText ("Password mismatch"); + } + } + } else { show_button_error (*change); @@ -1168,7 +1175,7 @@ wallet (wallet_a) change->setText ("Set/Change password"); }); } - }); + }); QObject::connect (change_rep, &QPushButton::released, [this] () { rai::account representative_l;