Passkeys: UI adjustments

This commit is contained in:
varjolintu 2023-11-25 12:45:29 +02:00 committed by Jonathan White
parent 6820400b11
commit 6d19ab8894
10 changed files with 180 additions and 161 deletions

View File

@ -847,10 +847,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>
@ -882,10 +878,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>
@ -899,23 +891,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
@ -928,27 +924,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?
@ -960,12 +944,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>
</context>
@ -1742,18 +1746,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">
@ -1774,10 +1770,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">
@ -1785,10 +1777,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>
@ -1802,6 +1790,22 @@ Permissions to access entries will be revoked.</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>
@ -5981,10 +5985,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>
@ -6029,6 +6029,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

@ -276,7 +276,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),
@ -560,7 +560,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()));
@ -582,7 +582,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),
@ -713,7 +713,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();
@ -777,7 +777,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,
@ -889,7 +889,7 @@ bool BrowserService::updateEntry(const EntryParameters& entryParameters, const Q
if (!browserSettings()->alwaysAllowUpdate()) {
raiseWindow();
dialogResult = MessageBox::question(m_currentDatabaseWidget,
tr("KeePassXC: Update Entry"),
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,
@ -925,7 +925,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

@ -174,10 +174,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;
}
@ -187,7 +185,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);
}
@ -227,12 +225,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>