mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2026-11-21 17:41:53 -08:00
Fix password strength evaluation for referenced passwords (#13479)
* Also fix password strength in entry view --------- Co-authored-by: Jonathan White <[email protected]>
This commit is contained in:
1 parent
6a534f38c6
commit
e888fec070
4 files changed
+20
-3
No files matched your search
+2
-2
@@ -231,7 +231,7 @@ QString Entry::defaultAutoTypeSequence() const
|
||||
const QSharedPointer<PasswordHealth> Entry::passwordHealth()
|
||||
{
|
||||
if (!m_data.passwordHealth) {
|
||||
m_data.passwordHealth.reset(new PasswordHealth(resolvePlaceholder(password())));
|
||||
m_data.passwordHealth.reset(new PasswordHealth(resolveMultiplePlaceholders(password())));
|
||||
}
|
||||
return m_data.passwordHealth;
|
||||
}
|
||||
@@ -239,7 +239,7 @@ const QSharedPointer<PasswordHealth> Entry::passwordHealth()
|
||||
const QSharedPointer<PasswordHealth> Entry::passwordHealth() const
|
||||
{
|
||||
if (!m_data.passwordHealth) {
|
||||
return QSharedPointer<PasswordHealth>::create(resolvePlaceholder(password()));
|
||||
return QSharedPointer<PasswordHealth>::create(resolveMultiplePlaceholders(password()));
|
||||
}
|
||||
return m_data.passwordHealth;
|
||||
}
|
||||
|
||||
@@ -95,7 +95,12 @@ PasswordWidget::PasswordWidget(QWidget* parent)
|
||||
m_ui->qualityProgressBar->setVisible(false);
|
||||
|
||||
connect(m_ui->passwordEdit, &QLineEdit::textChanged, this, [this](const QString& pwd) {
|
||||
updatePasswordStrength(pwd);
|
||||
QString resolvedPwd = pwd;
|
||||
|
||||
// Making a request to dereference the password
|
||||
emit requestPlaceholderResolution(pwd, resolvedPwd);
|
||||
|
||||
updatePasswordStrength(resolvedPwd);
|
||||
emit textChanged(pwd);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -48,6 +48,7 @@ public:
|
||||
|
||||
signals:
|
||||
void textChanged(QString text);
|
||||
void requestPlaceholderResolution(const QString& rawText, QString& resolvedText);
|
||||
|
||||
public slots:
|
||||
void setText(const QString& text);
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
#include "core/Metadata.h"
|
||||
#include "core/PasswordGenerator.h"
|
||||
#include "core/TimeDelta.h"
|
||||
#include "gui/PasswordWidget.h"
|
||||
#ifdef KPXC_FEATURE_SSHAGENT
|
||||
#include "sshagent/OpenSSHKey.h"
|
||||
#include "sshagent/OpenSSHKeyGenDialog.h"
|
||||
@@ -138,6 +139,16 @@ EditEntryWidget::EditEntryWidget(QWidget* parent)
|
||||
m_editWidgetProperties->setCustomData(m_customData.data());
|
||||
|
||||
m_mainUi->passwordEdit->setQualityVisible(true);
|
||||
|
||||
connect(m_mainUi->passwordEdit,
|
||||
&PasswordWidget::requestPlaceholderResolution,
|
||||
this,
|
||||
[this](const QString& rawText, QString& resolvedText) {
|
||||
if (m_entry) {
|
||||
// Dereferencing the password of the entry
|
||||
resolvedText = m_entry->resolveMultiplePlaceholders(rawText);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
EditEntryWidget::~EditEntryWidget() = default;
|
||||
|
||||
Reference in new issue
Block a user