mirror of
https://github.com/feather-wallet/feather.git
synced 2024-12-23 03:59:29 +00:00
Enter password to open seed, keys dialog
This commit is contained in:
parent
2b2107b32d
commit
e2a591baed
2 changed files with 25 additions and 0 deletions
|
@ -701,6 +701,10 @@ void MainWindow::showSeedDialog() {
|
|||
return;
|
||||
}
|
||||
|
||||
if (!this->verifyPassword()) {
|
||||
return;
|
||||
}
|
||||
|
||||
SeedDialog dialog{m_ctx, this};
|
||||
dialog.exec();
|
||||
}
|
||||
|
@ -772,6 +776,10 @@ void MainWindow::showRestoreHeightDialog() {
|
|||
}
|
||||
|
||||
void MainWindow::showKeysDialog() {
|
||||
if (!this->verifyPassword()) {
|
||||
return;
|
||||
}
|
||||
|
||||
KeysDialog dialog{m_ctx, this};
|
||||
dialog.exec();
|
||||
}
|
||||
|
@ -1557,6 +1565,22 @@ void MainWindow::updateRecentlyOpenedMenu() {
|
|||
ui->menuRecently_open->addAction(m_clearRecentlyOpenAction);
|
||||
}
|
||||
|
||||
bool MainWindow::verifyPassword() {
|
||||
bool ok;
|
||||
while (true) {
|
||||
QString password = QInputDialog::getText(this, "Enter password", "Please enter your password:", QLineEdit::EchoMode::Password, "", &ok);
|
||||
if (!ok) { // Dialog cancelled
|
||||
return false;
|
||||
}
|
||||
if (password != m_ctx->wallet->getPassword()) {
|
||||
QMessageBox::warning(this, "Error", "Incorrect password");
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void MainWindow::toggleSearchbar(bool visible) {
|
||||
config()->set(Config::showSearchbar, visible);
|
||||
|
||||
|
|
|
@ -212,6 +212,7 @@ private:
|
|||
void addToRecentlyOpened(const QString &filename);
|
||||
void updateRecentlyOpenedMenu();
|
||||
void updateWidgetIcons();
|
||||
bool verifyPassword();
|
||||
|
||||
QIcon hardwareDevicePairedIcon();
|
||||
QIcon hardwareDeviceUnpairedIcon();
|
||||
|
|
Loading…
Reference in a new issue