-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add action item for removing a passkey from entry (#10777)
- Loading branch information
1 parent
2f43ca4
commit 6fbab25
Showing
13 changed files
with
94 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
* Copyright (C) 2023 KeePassXC Team <[email protected]> | ||
* Copyright (C) 2024 KeePassXC Team <[email protected]> | ||
* Copyright (C) 2010 Felix Geyer <[email protected]> | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
|
@@ -551,6 +551,12 @@ bool Entry::hasPasskey() const | |
return m_attributes->hasPasskey(); | ||
} | ||
|
||
void Entry::removePasskey() | ||
{ | ||
m_attributes->removePasskeyAttributes(); | ||
removeTag(tr("Passkey")); | ||
} | ||
|
||
QString Entry::totp() const | ||
{ | ||
if (hasTotp()) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
* Copyright (C) 2023 KeePassXC Team <[email protected]> | ||
* Copyright (C) 2024 KeePassXC Team <[email protected]> | ||
* Copyright (C) 2010 Felix Geyer <[email protected]> | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
|
@@ -120,8 +120,10 @@ class Entry : public ModifiableObject | |
bool excludeFromReports() const; | ||
void setExcludeFromReports(bool state); | ||
|
||
bool hasTotp() const; | ||
bool hasPasskey() const; | ||
void removePasskey(); | ||
|
||
bool hasTotp() const; | ||
bool isExpired() const; | ||
bool willExpireInDays(int days) const; | ||
bool isRecycled() const; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
* Copyright (C) 2023 KeePassXC Team <[email protected]> | ||
* Copyright (C) 2024 KeePassXC Team <[email protected]> | ||
* Copyright (C) 2012 Felix Geyer <[email protected]> | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
|
@@ -65,6 +65,16 @@ bool EntryAttributes::hasPasskey() const | |
return false; | ||
} | ||
|
||
void EntryAttributes::removePasskeyAttributes() | ||
{ | ||
const auto keyList = keys(); | ||
for (const auto& key : keyList) { | ||
if (isPasskeyAttribute(key)) { | ||
remove(key); | ||
} | ||
} | ||
} | ||
|
||
QList<QString> EntryAttributes::customKeys() const | ||
{ | ||
QList<QString> customKeys; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
* Copyright (C) 2023 KeePassXC Team <[email protected]> | ||
* Copyright (C) 2024 KeePassXC Team <[email protected]> | ||
* Copyright (C) 2012 Felix Geyer <[email protected]> | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
|
@@ -34,6 +34,7 @@ class EntryAttributes : public ModifiableObject | |
QList<QString> keys() const; | ||
bool hasKey(const QString& key) const; | ||
bool hasPasskey() const; | ||
void removePasskeyAttributes(); | ||
QList<QString> customKeys() const; | ||
QString value(const QString& key) const; | ||
QList<QString> values(const QList<QString>& keys) const; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
* Copyright (C) 2023 KeePassXC Team <[email protected]> | ||
* Copyright (C) 2024 KeePassXC Team <[email protected]> | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
|
@@ -565,6 +565,11 @@ void DatabaseTabWidget::importPasskeyToEntry() | |
{ | ||
currentDatabaseWidget()->showImportPasskeyDialog(true); | ||
} | ||
|
||
void DatabaseTabWidget::removePasskeyFromEntry() | ||
{ | ||
currentDatabaseWidget()->removePasskeyFromEntry(); | ||
} | ||
#endif | ||
|
||
bool DatabaseTabWidget::isModified(int index) const | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
* Copyright (C) 2023 KeePassXC Team <[email protected]> | ||
* Copyright (C) 2024 KeePassXC Team <[email protected]> | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
|
@@ -87,6 +87,7 @@ public slots: | |
void showPasskeys(); | ||
void importPasskey(); | ||
void importPasskeyToEntry(); | ||
void removePasskeyFromEntry(); | ||
#endif | ||
void performGlobalAutoType(const QString& search); | ||
void performBrowserUnlock(); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
* Copyright (C) 2023 KeePassXC Team <[email protected]> | ||
* Copyright (C) 2024 KeePassXC Team <[email protected]> | ||
* Copyright (C) 2010 Felix Geyer <[email protected]> | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
|
@@ -212,6 +212,8 @@ public slots: | |
#ifdef WITH_XC_BROWSER_PASSKEYS | ||
void switchToPasskeys(); | ||
void showImportPasskeyDialog(bool isEntry = false); | ||
void removePasskeyFromEntry(); | ||
bool currentEntryHasPasskey(); | ||
#endif | ||
void switchToOpenDatabase(); | ||
void switchToOpenDatabase(const QString& filePath); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
* Copyright (C) 2023 KeePassXC Team <[email protected]> | ||
* Copyright (C) 2024 KeePassXC Team <[email protected]> | ||
* Copyright (C) 2010 Felix Geyer <[email protected]> | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
|
@@ -137,6 +137,7 @@ MainWindow::MainWindow() | |
m_entryContextMenu->addSeparator(); | ||
#ifdef WITH_XC_BROWSER_PASSKEYS | ||
m_entryContextMenu->addAction(m_ui->actionEntryImportPasskey); | ||
m_entryContextMenu->addAction(m_ui->actionEntryRemovePasskey); | ||
m_entryContextMenu->addSeparator(); | ||
#endif | ||
m_entryContextMenu->addAction(m_ui->actionEntryEdit); | ||
|
@@ -446,6 +447,7 @@ MainWindow::MainWindow() | |
m_ui->actionPasskeys->setIcon(icons()->icon("passkey")); | ||
m_ui->actionImportPasskey->setIcon(icons()->icon("document-import")); | ||
m_ui->actionEntryImportPasskey->setIcon(icons()->icon("document-import")); | ||
m_ui->actionEntryRemovePasskey->setIcon(icons()->icon("document-close")); | ||
#endif | ||
|
||
m_actionMultiplexer.connect( | ||
|
@@ -497,6 +499,7 @@ MainWindow::MainWindow() | |
connect(m_ui->actionPasskeys, SIGNAL(triggered()), m_ui->tabWidget, SLOT(showPasskeys())); | ||
connect(m_ui->actionImportPasskey, SIGNAL(triggered()), m_ui->tabWidget, SLOT(importPasskey())); | ||
connect(m_ui->actionEntryImportPasskey, SIGNAL(triggered()), m_ui->tabWidget, SLOT(importPasskeyToEntry())); | ||
connect(m_ui->actionEntryRemovePasskey, SIGNAL(triggered()), m_ui->tabWidget, SLOT(removePasskeyFromEntry())); | ||
#endif | ||
connect(m_ui->actionImport, SIGNAL(triggered()), m_ui->tabWidget, SLOT(importFile())); | ||
connect(m_ui->actionExportCsv, SIGNAL(triggered()), m_ui->tabWidget, SLOT(exportToCsv())); | ||
|
@@ -990,9 +993,11 @@ void MainWindow::setMenuActionState(DatabaseWidget::Mode mode) | |
m_ui->actionExportXML->setEnabled(true); | ||
m_ui->actionDatabaseMerge->setEnabled(m_ui->tabWidget->currentIndex() != -1); | ||
#ifdef WITH_XC_BROWSER_PASSKEYS | ||
bool singleEntryHasPasskey = singleEntrySelected && dbWidget->currentEntryHasPasskey(); | ||
m_ui->actionPasskeys->setEnabled(true); | ||
m_ui->actionImportPasskey->setEnabled(true); | ||
m_ui->actionEntryImportPasskey->setEnabled(singleEntrySelected); | ||
m_ui->actionEntryRemovePasskey->setEnabled(singleEntryHasPasskey); | ||
#endif | ||
#ifdef WITH_XC_SSHAGENT | ||
bool singleEntryHasSshKey = | ||
|
@@ -1064,10 +1069,12 @@ void MainWindow::setMenuActionState(DatabaseWidget::Mode mode) | |
m_ui->actionPasskeys->setEnabled(false); | ||
m_ui->actionImportPasskey->setEnabled(false); | ||
m_ui->actionEntryImportPasskey->setEnabled(false); | ||
m_ui->actionEntryRemovePasskey->setEnabled(false); | ||
#else | ||
m_ui->actionPasskeys->setVisible(false); | ||
m_ui->actionImportPasskey->setVisible(false); | ||
m_ui->actionEntryImportPasskey->setVisible(false); | ||
m_ui->actionEntryRemovePasskey->setVisible(false); | ||
#endif | ||
|
||
m_searchWidgetAction->setEnabled(false); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters