mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-02-18 21:34:15 -05:00
Bug #218
Do not accept faulty files as Key File. Moreover, do not clear keys unless we have a key to add.
This commit is contained in:
parent
a7f4e2d0cd
commit
58061af959
@ -96,7 +96,7 @@ QLabel* ChangeMasterKeyWidget::headlineLabel()
|
||||
|
||||
void ChangeMasterKeyWidget::generateKey()
|
||||
{
|
||||
m_key.clear();
|
||||
bool cleared = false;
|
||||
|
||||
if (m_ui->passwordGroup->isChecked()) {
|
||||
if (m_ui->enterPasswordEdit->text() == m_ui->repeatPasswordEdit->text()) {
|
||||
@ -107,6 +107,8 @@ void ChangeMasterKeyWidget::generateKey()
|
||||
return;
|
||||
}
|
||||
}
|
||||
m_key.clear();
|
||||
cleared = true;
|
||||
m_key.addKey(PasswordKey(m_ui->enterPasswordEdit->text()));
|
||||
}
|
||||
else {
|
||||
@ -120,8 +122,12 @@ void ChangeMasterKeyWidget::generateKey()
|
||||
FileKey fileKey;
|
||||
QString errorMsg;
|
||||
if (!fileKey.load(m_ui->keyFileCombo->currentText(), &errorMsg)) {
|
||||
// TODO: error handling
|
||||
MessageBox::critical(this, tr("Failed to set key file"),
|
||||
tr("Failed to set %1 as the Key file:\n%2")
|
||||
.arg(m_ui->keyFileCombo->currentText(), errorMsg));
|
||||
return;
|
||||
}
|
||||
if (!cleared) m_key.clear();
|
||||
m_key.addKey(fileKey);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user