Warn user when no authentication factor was chosen

This commit is contained in:
Janek Bevendorff 2017-02-20 23:35:03 +01:00
parent 5d068dfb23
commit 2d4e08e060
No known key found for this signature in database
GPG Key ID: CFEC2F6850BFFA53

View File

@ -118,12 +118,24 @@ void ChangeMasterKeyWidget::generateKey()
{ {
m_key.clear(); m_key.clear();
bool anyChecked = m_ui->passwordGroup->isChecked();
anyChecked |= m_ui->keyFileGroup->isChecked();
anyChecked |= m_ui->challengeResponseGroup->isChecked();
if (!anyChecked) {
if (MessageBox::warning(this, tr("No authentication factor chosen"),
tr("Your database will be completely unprotected!<br>Do you really want to continue?"),
QMessageBox::Yes | QMessageBox::No) != QMessageBox::Yes) {
return;
}
}
if (m_ui->passwordGroup->isChecked()) { if (m_ui->passwordGroup->isChecked()) {
if (m_ui->enterPasswordEdit->text() == m_ui->repeatPasswordEdit->text()) { if (m_ui->enterPasswordEdit->text() == m_ui->repeatPasswordEdit->text()) {
if (m_ui->enterPasswordEdit->text().isEmpty()) { if (m_ui->enterPasswordEdit->text().isEmpty()) {
if (MessageBox::question(this, tr("Question"), if (MessageBox::warning(this, tr("Empty password"),
tr("Do you really want to use an empty string as password?"), tr("Do you really want to use an empty string as password?"),
QMessageBox::Yes | QMessageBox::No) != QMessageBox::Yes) { QMessageBox::Yes | QMessageBox::No) != QMessageBox::Yes) {
return; return;
} }
} }