Skip to content

Commit

Permalink
Add warning prior to export of database
Browse files Browse the repository at this point in the history
* Ensures user is aware that the exported data is unencrypted and vulnerable
  • Loading branch information
droidmonkey committed Jun 30, 2019
1 parent aac76ad commit d12f15d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/gui/DatabaseTabWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,10 @@ void DatabaseTabWidget::exportToCsv()
return;
}

if (!warnOnExport()) {
return;
}

QString fileName = fileDialog()->getSaveFileName(
this, tr("Export database to CSV file"), QString(), tr("CSV file").append(" (*.csv)"), nullptr, nullptr, "csv");
if (fileName.isEmpty()) {
Expand All @@ -411,6 +415,10 @@ void DatabaseTabWidget::exportToHtml()
return;
}

if (!warnOnExport()) {
return;
}

QString fileName = fileDialog()->getSaveFileName(this,
tr("Export database to HTML file"),
QString(),
Expand All @@ -429,6 +437,18 @@ void DatabaseTabWidget::exportToHtml()
}
}

bool DatabaseTabWidget::warnOnExport()
{
auto ans =
MessageBox::question(this,
tr("Export Confirmation"),
tr("You are about to export your database to an unencrypted file. This will leave your "
"passwords and sensitive information vulnerable! Are you sure you want to continue?"),
MessageBox::Yes | MessageBox::No,
MessageBox::No);
return ans == MessageBox::Yes;
}

void DatabaseTabWidget::changeMasterKey()
{
currentDatabaseWidget()->switchToMasterKeyChange();
Expand Down
1 change: 1 addition & 0 deletions src/gui/DatabaseTabWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ private slots:
private:
QSharedPointer<Database> execNewDatabaseWizard();
void updateLastDatabases(const QString& filename);
bool warnOnExport();

QPointer<DatabaseWidgetStateSync> m_dbWidgetStateSync;
QPointer<DatabaseWidget> m_dbWidgetPendingLock;
Expand Down

0 comments on commit d12f15d

Please sign in to comment.