mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-10-01 01:26:01 -04:00
Database key settings: fix UI bug
Fix a bug in the database key settings dialog, where it was previously always incorrectly applying an empty password if the password was not changed but some other change was made (e.g. adding or removing a key file).
This commit is contained in:
parent
0a516d526c
commit
854459068f
@ -62,7 +62,7 @@ bool PasswordEditWidget::isPasswordVisible() const
|
||||
|
||||
bool PasswordEditWidget::isEmpty() const
|
||||
{
|
||||
return visiblePage() != Page::Edit || m_compUi->enterPasswordEdit->text().isEmpty();
|
||||
return m_compUi->enterPasswordEdit->text().isEmpty();
|
||||
}
|
||||
|
||||
PasswordHealth::Quality PasswordEditWidget::getPasswordQuality() const
|
||||
|
@ -160,7 +160,9 @@ bool DatabaseSettingsWidgetDatabaseKey::saveSettings()
|
||||
}
|
||||
|
||||
// Show warning if database password has not been set
|
||||
if (m_passwordEditWidget->visiblePage() == KeyComponentWidget::Page::AddNew || m_passwordEditWidget->isEmpty()) {
|
||||
if (m_passwordEditWidget->visiblePage() == KeyComponentWidget::Page::AddNew
|
||||
|| (m_passwordEditWidget->visiblePage() == KeyComponentWidget::Page::Edit && m_passwordEditWidget->isEmpty())) {
|
||||
|
||||
QScopedPointer<QMessageBox> msgBox(new QMessageBox(this));
|
||||
msgBox->setIcon(QMessageBox::Warning);
|
||||
msgBox->setWindowTitle(tr("No password set"));
|
||||
@ -179,7 +181,7 @@ bool DatabaseSettingsWidgetDatabaseKey::saveSettings()
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!m_passwordEditWidget->isEmpty()) {
|
||||
if (m_passwordEditWidget->visiblePage() == KeyComponentWidget::Page::Edit && !m_passwordEditWidget->isEmpty()) {
|
||||
// Prevent setting password with a quality less than the minimum required
|
||||
auto minQuality = qBound(0, config()->get(Config::Security_DatabasePasswordMinimumQuality).toInt(), 4);
|
||||
if (m_passwordEditWidget->getPasswordQuality() < static_cast<PasswordHealth::Quality>(minQuality)) {
|
||||
|
Loading…
Reference in New Issue
Block a user