Skip to content

Commit

Permalink
Add password strength indicator to PasswordEditWidget
Browse files Browse the repository at this point in the history
Fixes #7437 (entry edit view only)
Fixes #5220
  • Loading branch information
jmdana committed Apr 14, 2022
1 parent 692c95b commit 7baf8fa
Show file tree
Hide file tree
Showing 21 changed files with 2,584 additions and 2,331 deletions.
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ set(keepassx_SOURCES
gui/MessageBox.cpp
gui/MessageWidget.cpp
gui/OpVaultOpenWidget.cpp
gui/PasswordEdit.cpp
gui/PasswordWidget.cpp
gui/PasswordGeneratorWidget.cpp
gui/ApplicationSettingsWidget.cpp
gui/Icons.cpp
Expand Down
6 changes: 3 additions & 3 deletions src/autotype/PickcharsDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ PickcharsDialog::PickcharsDialog(const QString& string, QWidget* parent)
// Remove last selected character
auto shortcut = new QShortcut(Qt::Key_Backspace, this);
connect(shortcut, &QShortcut::activated, this, [this] {
auto text = m_ui->selectedChars->text();
auto text = m_ui->selectedChars->getText();
m_ui->selectedChars->setText(text.left(text.size() - 1));
});
// Submit the form
Expand Down Expand Up @@ -134,7 +134,7 @@ void PickcharsDialog::downPressed()

QString PickcharsDialog::selectedChars()
{
return m_ui->selectedChars->text();
return m_ui->selectedChars->getText();
}

bool PickcharsDialog::pressTab()
Expand All @@ -149,7 +149,7 @@ void PickcharsDialog::charSelected()
return;
}

m_ui->selectedChars->setText(m_ui->selectedChars->text() + btn->property("char").toChar());
m_ui->selectedChars->setText(m_ui->selectedChars->getText() + btn->property("char").toChar());
}

void PickcharsDialog::showEvent(QShowEvent* event)
Expand Down
8 changes: 4 additions & 4 deletions src/autotype/PickcharsDialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<layout class="QGridLayout" name="charsGrid"/>
</item>
<item>
<widget class="PasswordEdit" name="selectedChars">
<widget class="PasswordWidget" name="selectedChars">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
Expand Down Expand Up @@ -74,9 +74,9 @@
</widget>
<customwidgets>
<customwidget>
<class>PasswordEdit</class>
<extends>QLineEdit</extends>
<header>gui/PasswordEdit.h</header>
<class>PasswordWidget</class>
<extends>QWidget</extends>
<header>gui/PasswordWidget.h</header>
</customwidget>
</customwidgets>
<tabstops>
Expand Down
8 changes: 4 additions & 4 deletions src/gui/DatabaseOpenWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ void DatabaseOpenWidget::openDatabase()
emit dialogFinished(true);
clearForms();
} else {
if (!isOnQuickUnlockScreen() && m_ui->editPassword->text().isEmpty() && !m_retryUnlockWithEmptyPassword) {
if (!isOnQuickUnlockScreen() && m_ui->editPassword->getText().isEmpty() && !m_retryUnlockWithEmptyPassword) {
QScopedPointer<QMessageBox> msgBox(new QMessageBox(this));
msgBox->setIcon(QMessageBox::Critical);
msgBox->setWindowTitle(tr("Unlock failed and no password given"));
Expand Down Expand Up @@ -348,15 +348,15 @@ QSharedPointer<CompositeKey> DatabaseOpenWidget::buildDatabaseKey()
return databaseKey;
}

if (!m_ui->editPassword->text().isEmpty() || m_retryUnlockWithEmptyPassword) {
databaseKey->addKey(QSharedPointer<PasswordKey>::create(m_ui->editPassword->text()));
if (!m_ui->editPassword->getText().isEmpty() || m_retryUnlockWithEmptyPassword) {
databaseKey->addKey(QSharedPointer<PasswordKey>::create(m_ui->editPassword->getText()));
}

auto lastKeyFiles = config()->get(Config::LastKeyFiles).toHash();
lastKeyFiles.remove(m_filename);

auto key = QSharedPointer<FileKey>::create();
QString keyFilename = m_ui->keyFileLineEdit->text();
QString keyFilename = m_ui->keyFileLineEdit->getText();
if (!keyFilename.isEmpty()) {
QString errorMsg;
if (!key->load(keyFilename, &errorMsg)) {
Expand Down
Loading

0 comments on commit 7baf8fa

Please sign in to comment.