Passkeys: UI adjustments

This commit is contained in:
Jonathan White 2024-01-12 18:24:14 -05:00
parent fe739578ab
commit 4bd9fdd7a4
10 changed files with 181 additions and 162 deletions

View File

@ -843,10 +843,6 @@ Please select the correct database for saving credentials.</source>
</context>
<context>
<name>BrowserPasskeysConfirmationDialog</name>
<message>
<source>KeePassXC: Passkey credentials</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Cancel</source>
<translation type="unfinished"></translation>
@ -878,10 +874,6 @@ Please select the correct database for saving credentials.</source>
<source>Do you want to register Passkey for:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>%1 (%2)</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Existing Passkey found.
Do you want to register a new Passkey for:</source>
@ -895,23 +887,27 @@ Do you want to register a new Passkey for:</source>
<source>Authenticate Passkey credentials for:</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Relying Party: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Username: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>KeePassXC - Passkey credentials</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>BrowserService</name>
<message>
<source>KeePassXC: Create a new group</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>A request for creating a new group &quot;%1&quot; has been received.
Do you want to create this group?
</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>KeePassXC: New key association request</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>You have received an association request for the following database:
%1
@ -924,27 +920,15 @@ chrome-laptop.</source>
<source>Save and allow access</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>KeePassXC: Overwrite existing key?</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>A shared encryption key with the name &quot;%1&quot; already exists.
Do you want to overwrite it?</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>KeePassXC: Update Entry</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Do you want to update the information in %1 - %2?</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>KeePassXC: Delete entry</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>A request for deleting entry &quot;%1&quot; has been received.
Do you want to delete the entry?
@ -956,12 +940,32 @@ Do you want to delete the entry?
<translation type="unfinished"></translation>
</message>
<message>
<source>KeePassXC: Update Passkey</source>
<source>Entry already has a Passkey.
Do you want to overwrite the Passkey in %1 - %2?</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Entry already has a Passkey.
Do you want to overwrite the Passkey in %1 - %2?</source>
<source>KeePassXC - Create a new group</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>KeePassXC - New key association request</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>KeePassXC - Overwrite existing key?</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>KeePassXC - Update Passkey</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>KeePassXC - Update Entry</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>KeePassXC - Delete entry</source>
<translation type="unfinished"></translation>
</message>
<message>
@ -1796,18 +1800,10 @@ This may prevent connection to the browser plugin.</source>
This may prevent connection to the browser plugin.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>KeePassXC: No keys found</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>No shared encryption keys found in KeePassXC settings.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>KeePassXC: Removed keys from database</source>
<translation type="unfinished"></translation>
</message>
<message numerus="yes">
<source>Successfully removed %n encryption key(s) from KeePassXC settings.</source>
<translation type="unfinished">
@ -1828,10 +1824,6 @@ Permissions to access entries will be revoked.</source>
<source>Abort</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>KeePassXC: Removed permissions</source>
<translation type="unfinished"></translation>
</message>
<message numerus="yes">
<source>Successfully removed permissions from %n entry(s).</source>
<translation type="unfinished">
@ -1839,10 +1831,6 @@ Permissions to access entries will be revoked.</source>
<numerusform></numerusform>
</translation>
</message>
<message>
<source>KeePassXC: No entry with permissions found!</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>The active database does not contain an entry with permissions.</source>
<translation type="unfinished"></translation>
@ -1865,6 +1853,22 @@ This is necessary to maintain compatibility with the browser plugin.</source>
This is only necessary if your database is a copy of another and the browser extension cannot connect.</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>No keys found</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Removed keys from database</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Removed permissions</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>No entry with permissions found!</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>DatabaseSettingsWidgetDatabaseKey</name>
@ -6026,10 +6030,6 @@ Do you want to overwrite it?
<source>KeePassXC - Passkey Import</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>URL: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Username: %1</source>
<translation type="unfinished"></translation>
@ -6074,6 +6074,10 @@ Do you want to overwrite it?
<source>Default Passkeys group (Imported Passkeys)</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Relying Party: %1</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>PasskeyImporter</name>

View File

@ -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<Entry*>& 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<Entry*>& 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);

View File

@ -38,10 +38,10 @@ public:
~BrowserPasskeysConfirmationDialog() override;
void registerCredential(const QString& username,
const QString& siteId,
const QString& relyingParty,
const QList<Entry*>& existingEntries,
int timeout);
void authenticateCredential(const QList<Entry*>& entries, const QString& origin, int timeout);
void authenticateCredential(const QList<Entry*>& entries, const QString& relyingParty, int timeout);
Entry* getSelectedEntry() const;
bool isPasskeyUpdated() const;

View File

@ -6,69 +6,73 @@
<rect>
<x>0</x>
<y>0</y>
<width>405</width>
<height>282</height>
<width>400</width>
<height>274</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>KeePassXC: Passkey credentials</string>
<string>KeePassXC - Passkey credentials</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="firstLabel">
<property name="font">
<font>
<bold>true</bold>
</font>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="dataLabel">
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="secondLabel">
<property name="font">
<font>
<bold>true</bold>
</font>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>10</height>
</size>
</property>
</spacer>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QLabel" name="firstLabel">
<property name="font">
<font>
<bold>true</bold>
</font>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="relyingPartyLabel">
<property name="text">
<string>Relying Party: %1</string>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="usernameLabel">
<property name="text">
<string>Username: %1</string>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="secondLabel">
<property name="font">
<font>
<bold>true</bold>
</font>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QTableWidget" name="credentialsTable">

View File

@ -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()),

View File

@ -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);
}

View File

@ -86,6 +86,16 @@
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="cancelButton">
<property name="text">
<string>Cancel</string>
</property>
<property name="autoDefault">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="exportButton">
<property name="accessibleName">
@ -102,16 +112,6 @@
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="cancelButton">
<property name="text">
<string>Cancel</string>
</property>
<property name="autoDefault">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>

View File

@ -45,12 +45,12 @@ PasskeyImportDialog::~PasskeyImportDialog()
{
}
void PasskeyImportDialog::setInfo(const QString& url,
void PasskeyImportDialog::setInfo(const QString& relyingParty,
const QString& username,
const QSharedPointer<Database>& 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) {

View File

@ -36,7 +36,10 @@ public:
explicit PasskeyImportDialog(QWidget* parent = nullptr);
~PasskeyImportDialog() override;
void setInfo(const QString& url, const QString& username, const QSharedPointer<Database>& database, bool isEntry);
void setInfo(const QString& relyingParty,
const QString& username,
const QSharedPointer<Database>& database,
bool isEntry);
QSharedPointer<Database> getSelectedDatabase() const;
QUuid getSelectedEntryUuid() const;
QUuid getSelectedGroupUuid() const;

View File

@ -44,9 +44,12 @@
</widget>
</item>
<item>
<widget class="QLabel" name="urlLabel">
<widget class="QLabel" name="relyingPartyLabel">
<property name="text">
<string>URL: %1</string>
<string>Relying Party: %1</string>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
@ -58,24 +61,14 @@
<property name="text">
<string>Username: %1</string>
</property>
<property name="textFormat">
<enum>Qt::PlainText</enum>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>10</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QGroupBox" name="groupBox">
<layout class="QVBoxLayout" name="verticalLayout_3">
@ -118,6 +111,19 @@
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>10</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
@ -133,6 +139,16 @@
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="cancelButton">
<property name="text">
<string>Cancel</string>
</property>
<property name="autoDefault">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="importButton">
<property name="accessibleName">
@ -149,16 +165,6 @@
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="cancelButton">
<property name="text">
<string>Cancel</string>
</property>
<property name="autoDefault">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>