From 7880c0e4f5e7fc4fcc7ad18ca5e77a100cc235e2 Mon Sep 17 00:00:00 2001 From: Florian Geyer Date: Wed, 11 Apr 2012 13:53:46 +0200 Subject: [PATCH] Check both password edit fields. --- src/gui/ChangeMasterKeyWidget.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/gui/ChangeMasterKeyWidget.cpp b/src/gui/ChangeMasterKeyWidget.cpp index 6172b31dc..241728c54 100644 --- a/src/gui/ChangeMasterKeyWidget.cpp +++ b/src/gui/ChangeMasterKeyWidget.cpp @@ -18,6 +18,8 @@ #include "ChangeMasterKeyWidget.h" #include "ui_ChangeMasterKeyWidget.h" +#include + #include "keys/FileKey.h" #include "keys/PasswordKey.h" @@ -61,7 +63,20 @@ void ChangeMasterKeyWidget::generateKey() m_key.clear(); if (m_ui->passwordGroup->isChecked()) { - m_key.addKey(PasswordKey(m_ui->enterPasswordEdit->text())); + if (m_ui->enterPasswordEdit->text() == m_ui->repeatPasswordEdit->text()) { + if (m_ui->enterPasswordEdit->text().isEmpty()) { + if (QMessageBox::question(this, tr("Question"), tr("Do you really want to use an empty string as password?"), QMessageBox::Yes | QMessageBox::No) != QMessageBox::Yes) { + return; + } + } + m_key.addKey(PasswordKey(m_ui->enterPasswordEdit->text())); + } + else { + QMessageBox::warning(this, tr("Error"), tr("Different passwords supplied.")); + m_ui->enterPasswordEdit->setText(""); + m_ui->repeatPasswordEdit->setText(""); + return; + } } if (m_ui->keyFileGroup->isChecked()) { FileKey fileKey;