From 54d829b7acf16dea06c667826d7a444eb03d127b Mon Sep 17 00:00:00 2001 From: Jonathan White Date: Fri, 12 Jan 2024 18:24:14 -0500 Subject: [PATCH] Passkeys: UI adjustments --- share/translations/keepassxc_en.ts | 102 +++++++++-------- .../BrowserPasskeysConfirmationDialog.cpp | 12 +- .../BrowserPasskeysConfirmationDialog.h | 4 +- .../BrowserPasskeysConfirmationDialog.ui | 108 +++++++++--------- src/browser/BrowserService.cpp | 16 +-- .../DatabaseSettingsWidgetBrowser.cpp | 12 +- src/gui/passkeys/PasskeyExportDialog.ui | 20 ++-- src/gui/passkeys/PasskeyImportDialog.cpp | 4 +- src/gui/passkeys/PasskeyImportDialog.h | 5 +- src/gui/passkeys/PasskeyImportDialog.ui | 56 +++++---- 10 files changed, 179 insertions(+), 160 deletions(-) diff --git a/share/translations/keepassxc_en.ts b/share/translations/keepassxc_en.ts index e1a6542abe..4427ca4882 100644 --- a/share/translations/keepassxc_en.ts +++ b/share/translations/keepassxc_en.ts @@ -843,10 +843,6 @@ Please select the correct database for saving credentials. BrowserPasskeysConfirmationDialog - - KeePassXC: Passkey credentials - - Cancel @@ -878,10 +874,6 @@ Please select the correct database for saving credentials. Do you want to register Passkey for: - - %1 (%2) - - Existing Passkey found. Do you want to register a new Passkey for: @@ -895,21 +887,25 @@ Do you want to register a new Passkey for: Authenticate Passkey credentials for: - - - BrowserService - KeePassXC: Create a new group + Relying Party: %1 - A request for creating a new group "%1" has been received. -Do you want to create this group? - + Username: %1 - KeePassXC: New key association request + KeePassXC - Passkey credentials + + + + + BrowserService + + A request for creating a new group "%1" has been received. +Do you want to create this group? + @@ -925,43 +921,51 @@ chrome-laptop. - KeePassXC: Overwrite existing key? + A shared encryption key with the name "%1" already exists. +Do you want to overwrite it? - A shared encryption key with the name "%1" already exists. -Do you want to overwrite it? + Do you want to update the information in %1 - %2? - KeePassXC: Update Entry + A request for deleting entry "%1" has been received. +Do you want to delete the entry? + - Do you want to update the information in %1 - %2? + %1 (Passkey) - KeePassXC: Delete entry + Entry already has a Passkey. +Do you want to overwrite the Passkey in %1 - %2? - A request for deleting entry "%1" has been received. -Do you want to delete the entry? - + KeePassXC - Create a new group - %1 (Passkey) + KeePassXC - New key association request - KeePassXC: Update Passkey + KeePassXC - Overwrite existing key? - Entry already has a Passkey. -Do you want to overwrite the Passkey in %1 - %2? + KeePassXC - Update Passkey + + + + KeePassXC - Update Entry + + + + KeePassXC - Delete entry @@ -1796,18 +1800,10 @@ This may prevent connection to the browser plugin. This may prevent connection to the browser plugin. - - KeePassXC: No keys found - - No shared encryption keys found in KeePassXC settings. - - KeePassXC: Removed keys from database - - Successfully removed %n encryption key(s) from KeePassXC settings. @@ -1828,10 +1824,6 @@ Permissions to access entries will be revoked. Abort - - KeePassXC: Removed permissions - - Successfully removed permissions from %n entry(s). @@ -1839,10 +1831,6 @@ Permissions to access entries will be revoked. - - KeePassXC: No entry with permissions found! - - The active database does not contain an entry with permissions. @@ -1865,6 +1853,22 @@ This is necessary to maintain compatibility with the browser plugin. This is only necessary if your database is a copy of another and the browser extension cannot connect. + + No keys found + + + + Removed keys from database + + + + Removed permissions + + + + No entry with permissions found! + + DatabaseSettingsWidgetDatabaseKey @@ -6026,10 +6030,6 @@ Do you want to overwrite it? KeePassXC - Passkey Import - - URL: %1 - - Username: %1 @@ -6074,6 +6074,10 @@ Do you want to overwrite it? Default Passkeys group (Imported Passkeys) + + Relying Party: %1 + + PasskeyImporter diff --git a/src/browser/BrowserPasskeysConfirmationDialog.cpp b/src/browser/BrowserPasskeysConfirmationDialog.cpp index af62488f16..644bec599d 100644 --- a/src/browser/BrowserPasskeysConfirmationDialog.cpp +++ b/src/browser/BrowserPasskeysConfirmationDialog.cpp @@ -33,6 +33,7 @@ BrowserPasskeysConfirmationDialog::BrowserPasskeysConfirmationDialog(QWidget* pa m_ui->setupUi(this); m_ui->updateButton->setVisible(false); + m_ui->verticalLayout->setAlignment(Qt::AlignTop); connect(m_ui->credentialsTable, SIGNAL(cellDoubleClicked(int, int)), this, SLOT(accept())); connect(m_ui->confirmButton, SIGNAL(clicked()), SLOT(accept())); @@ -48,12 +49,13 @@ BrowserPasskeysConfirmationDialog::~BrowserPasskeysConfirmationDialog() } void BrowserPasskeysConfirmationDialog::registerCredential(const QString& username, - const QString& siteId, + const QString& relyingParty, const QList& existingEntries, int timeout) { m_ui->firstLabel->setText(tr("Do you want to register Passkey for:")); - m_ui->dataLabel->setText(tr("%1 (%2)").arg(username, siteId)); + m_ui->relyingPartyLabel->setText(tr("Relying Party: %1").arg(relyingParty)); + m_ui->usernameLabel->setText(tr("Username: %1").arg(username)); m_ui->secondLabel->setText(""); if (!existingEntries.isEmpty()) { @@ -64,6 +66,7 @@ void BrowserPasskeysConfirmationDialog::registerCredential(const QString& userna m_ui->confirmButton->setText(tr("Register new")); updateEntriesToTable(existingEntries); } else { + m_ui->verticalLayout->setSizeConstraint(QLayout::SetFixedSize); m_ui->confirmButton->setText(tr("Register")); m_ui->credentialsTable->setVisible(false); } @@ -72,11 +75,12 @@ void BrowserPasskeysConfirmationDialog::registerCredential(const QString& userna } void BrowserPasskeysConfirmationDialog::authenticateCredential(const QList& entries, - const QString& origin, + const QString& relyingParty, int timeout) { m_ui->firstLabel->setText(tr("Authenticate Passkey credentials for:")); - m_ui->dataLabel->setText(origin); + m_ui->relyingPartyLabel->setText(tr("Relying Party: %1").arg(relyingParty)); + m_ui->usernameLabel->setVisible(false); m_ui->secondLabel->setText(""); updateEntriesToTable(entries); startCounter(timeout); diff --git a/src/browser/BrowserPasskeysConfirmationDialog.h b/src/browser/BrowserPasskeysConfirmationDialog.h index 189c066a52..6e262ffda4 100644 --- a/src/browser/BrowserPasskeysConfirmationDialog.h +++ b/src/browser/BrowserPasskeysConfirmationDialog.h @@ -38,10 +38,10 @@ class BrowserPasskeysConfirmationDialog : public QDialog ~BrowserPasskeysConfirmationDialog() override; void registerCredential(const QString& username, - const QString& siteId, + const QString& relyingParty, const QList& existingEntries, int timeout); - void authenticateCredential(const QList& entries, const QString& origin, int timeout); + void authenticateCredential(const QList& entries, const QString& relyingParty, int timeout); Entry* getSelectedEntry() const; bool isPasskeyUpdated() const; diff --git a/src/browser/BrowserPasskeysConfirmationDialog.ui b/src/browser/BrowserPasskeysConfirmationDialog.ui index 5b566d725b..2d8fee5471 100755 --- a/src/browser/BrowserPasskeysConfirmationDialog.ui +++ b/src/browser/BrowserPasskeysConfirmationDialog.ui @@ -6,69 +6,73 @@ 0 0 - 405 - 282 + 400 + 274 - + 0 0 - KeePassXC: Passkey credentials + KeePassXC - Passkey credentials - - - - true - - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - - - - - Qt::PlainText - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - - - - - - true - - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - - - - - Qt::Vertical - - - QSizePolicy::Expanding - - - - 20 - 10 - - - + + + + + + true + + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + + + + + Relying Party: %1 + + + Qt::PlainText + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + Username: %1 + + + Qt::PlainText + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + + true + + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + + diff --git a/src/browser/BrowserService.cpp b/src/browser/BrowserService.cpp index 6344e1dbbf..484a9d21e0 100644 --- a/src/browser/BrowserService.cpp +++ b/src/browser/BrowserService.cpp @@ -248,7 +248,7 @@ QJsonObject BrowserService::createNewGroup(const QString& groupName) } auto dialogResult = MessageBox::warning(m_currentDatabaseWidget, - tr("KeePassXC: Create a new group"), + tr("KeePassXC - Create a new group"), tr("A request for creating a new group \"%1\" has been received.\n" "Do you want to create this group?\n") .arg(groupName), @@ -512,7 +512,7 @@ QString BrowserService::storeKey(const QString& key) do { QInputDialog keyDialog(m_currentDatabaseWidget); connect(m_currentDatabaseWidget, SIGNAL(databaseLockRequested()), &keyDialog, SLOT(reject())); - keyDialog.setWindowTitle(tr("KeePassXC: New key association request")); + keyDialog.setWindowTitle(tr("KeePassXC - New key association request")); keyDialog.setLabelText(tr("You have received an association request for the following database:\n%1\n\n" "Give the connection a unique name or ID, for example:\nchrome-laptop.") .arg(db->metadata()->name().toHtmlEscaped())); @@ -534,7 +534,7 @@ QString BrowserService::storeKey(const QString& key) contains = db->metadata()->customData()->contains(CustomData::BrowserKeyPrefix + id); if (contains) { dialogResult = MessageBox::warning(m_currentDatabaseWidget, - tr("KeePassXC: Overwrite existing key?"), + tr("KeePassXC - Overwrite existing key?"), tr("A shared encryption key with the name \"%1\" " "already exists.\nDo you want to overwrite it?") .arg(id), @@ -665,7 +665,7 @@ QJsonObject BrowserService::showPasskeysAuthenticationPrompt(const QJsonObject& raiseWindow(); BrowserPasskeysConfirmationDialog confirmDialog; - confirmDialog.authenticateCredential(entries, origin, timeout); + confirmDialog.authenticateCredential(entries, rpId, timeout); auto dialogResult = confirmDialog.exec(); if (dialogResult == QDialog::Accepted) { hideWindow(); @@ -729,7 +729,7 @@ void BrowserService::addPasskeyToEntry(Entry* entry, if (entry->hasPasskey()) { if (MessageBox::question( m_currentDatabaseWidget, - tr("KeePassXC: Update Passkey"), + tr("KeePassXC - Update Passkey"), tr("Entry already has a Passkey.\nDo you want to overwrite the Passkey in %1 - %2?") .arg(entry->title(), entry->attributes()->value(BrowserPasskeys::KPEX_PASSKEY_USERNAME)), MessageBox::Overwrite | MessageBox::Cancel, @@ -840,8 +840,8 @@ bool BrowserService::updateEntry(const EntryParameters& entryParameters, const Q MessageBox::Button dialogResult = MessageBox::No; if (!browserSettings()->alwaysAllowUpdate()) { raiseWindow(); - dialogResult = MessageBox::question(nullptr, - tr("KeePassXC: Update Entry"), + dialogResult = MessageBox::question(m_currentDatabaseWidget, + tr("KeePassXC - Update Entry"), tr("Do you want to update the information in %1 - %2?") .arg(QUrl(entryParameters.siteUrl).host(), username), MessageBox::Save | MessageBox::Cancel, @@ -878,7 +878,7 @@ bool BrowserService::deleteEntry(const QString& uuid) } auto dialogResult = MessageBox::warning(m_currentDatabaseWidget, - tr("KeePassXC: Delete entry"), + tr("KeePassXC - Delete entry"), tr("A request for deleting entry \"%1\" has been received.\n" "Do you want to delete the entry?\n") .arg(entry->title()), diff --git a/src/gui/dbsettings/DatabaseSettingsWidgetBrowser.cpp b/src/gui/dbsettings/DatabaseSettingsWidgetBrowser.cpp index aa91fa451d..aaa2aff6e7 100644 --- a/src/gui/dbsettings/DatabaseSettingsWidgetBrowser.cpp +++ b/src/gui/dbsettings/DatabaseSettingsWidgetBrowser.cpp @@ -178,10 +178,8 @@ void DatabaseSettingsWidgetBrowser::removeSharedEncryptionKeys() } if (keysToRemove.isEmpty()) { - MessageBox::information(this, - tr("KeePassXC: No keys found"), - tr("No shared encryption keys found in KeePassXC settings."), - MessageBox::Ok); + MessageBox::information( + this, tr("No keys found"), tr("No shared encryption keys found in KeePassXC settings."), MessageBox::Ok); return; } @@ -191,7 +189,7 @@ void DatabaseSettingsWidgetBrowser::removeSharedEncryptionKeys() const int count = keysToRemove.count(); MessageBox::information(this, - tr("KeePassXC: Removed keys from database"), + tr("Removed keys from database"), tr("Successfully removed %n encryption key(s) from KeePassXC settings.", "", count), MessageBox::Ok); } @@ -231,12 +229,12 @@ void DatabaseSettingsWidgetBrowser::removeStoredPermissions() if (counter > 0) { MessageBox::information(this, - tr("KeePassXC: Removed permissions"), + tr("Removed permissions"), tr("Successfully removed permissions from %n entry(s).", "", counter), MessageBox::Ok); } else { MessageBox::information(this, - tr("KeePassXC: No entry with permissions found!"), + tr("No entry with permissions found!"), tr("The active database does not contain an entry with permissions."), MessageBox::Ok); } diff --git a/src/gui/passkeys/PasskeyExportDialog.ui b/src/gui/passkeys/PasskeyExportDialog.ui index 4d4d7f5dbc..c974ebaac4 100755 --- a/src/gui/passkeys/PasskeyExportDialog.ui +++ b/src/gui/passkeys/PasskeyExportDialog.ui @@ -87,29 +87,29 @@ - - - Export entries - + - Export Selected + Cancel true - - true - - + + + Export entries + - Cancel + Export Selected true + + true + diff --git a/src/gui/passkeys/PasskeyImportDialog.cpp b/src/gui/passkeys/PasskeyImportDialog.cpp index 0c1c31e6d0..2762df510d 100644 --- a/src/gui/passkeys/PasskeyImportDialog.cpp +++ b/src/gui/passkeys/PasskeyImportDialog.cpp @@ -45,12 +45,12 @@ PasskeyImportDialog::~PasskeyImportDialog() { } -void PasskeyImportDialog::setInfo(const QString& url, +void PasskeyImportDialog::setInfo(const QString& relyingParty, const QString& username, const QSharedPointer& database, bool isEntry) { - m_ui->urlLabel->setText(tr("URL: %1").arg(url)); + m_ui->relyingPartyLabel->setText(tr("Relying Party: %1").arg(relyingParty)); m_ui->usernameLabel->setText(tr("Username: %1").arg(username)); if (isEntry) { diff --git a/src/gui/passkeys/PasskeyImportDialog.h b/src/gui/passkeys/PasskeyImportDialog.h index 705c6d187f..9a7c4437ca 100644 --- a/src/gui/passkeys/PasskeyImportDialog.h +++ b/src/gui/passkeys/PasskeyImportDialog.h @@ -36,7 +36,10 @@ class PasskeyImportDialog : public QDialog explicit PasskeyImportDialog(QWidget* parent = nullptr); ~PasskeyImportDialog() override; - void setInfo(const QString& url, const QString& username, const QSharedPointer& database, bool isEntry); + void setInfo(const QString& relyingParty, + const QString& username, + const QSharedPointer& database, + bool isEntry); QSharedPointer getSelectedDatabase() const; QUuid getSelectedEntryUuid() const; QUuid getSelectedGroupUuid() const; diff --git a/src/gui/passkeys/PasskeyImportDialog.ui b/src/gui/passkeys/PasskeyImportDialog.ui index ec8de7e062..ecca97b14a 100755 --- a/src/gui/passkeys/PasskeyImportDialog.ui +++ b/src/gui/passkeys/PasskeyImportDialog.ui @@ -44,9 +44,12 @@ - + - URL: %1 + Relying Party: %1 + + + Qt::PlainText Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter @@ -58,24 +61,14 @@ Username: %1 + + Qt::PlainText + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - Qt::Vertical - - - - 20 - 10 - - - - @@ -118,6 +111,19 @@ + + + + Qt::Vertical + + + + 20 + 10 + + + + @@ -134,29 +140,29 @@ - - - Import Passkey - + - Import + Cancel true - - true - - + + + Import Passkey + - Cancel + Import true + + true +