mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-09-20 21:04:44 -04:00
Add more granular Auto-Type confirmation settings (#12370)
This new setting gives users more control and safety: * When Auto-Type is invoked globally (e.g., via a system-wide hotkey), the confirmation popup will always appear, letting the user confirm which credentials will be auto-typed. * When Auto-Type is invoked from within KeePassXC's main window, the confirmation step can be skipped, since the user already can visually confirm which entry is being auto-typed. This balances usability and security, reducing friction for intended actions while providing an extra safeguard for potentially ambiguous global Auto-Type triggers. --------- Co-authored-by: Jonathan White <support@dmapps.us>
This commit is contained in:
parent
93423eda30
commit
448165613d
7 changed files with 67 additions and 6 deletions
|
@ -129,6 +129,8 @@ ApplicationSettingsWidget::ApplicationSettingsWidget(QWidget* parent)
|
|||
connect(m_generalUi->backupFilePathPicker, SIGNAL(pressed()), SLOT(selectBackupDirectory()));
|
||||
connect(m_generalUi->showExpiredEntriesOnDatabaseUnlockCheckBox, SIGNAL(toggled(bool)),
|
||||
SLOT(showExpiredEntriesOnDatabaseUnlockToggled(bool)));
|
||||
connect(m_generalUi->autoTypeAskCheckBox, SIGNAL(toggled(bool)),
|
||||
SLOT(autoTypeAskToggled(bool)));
|
||||
|
||||
connect(m_secUi->clearClipboardCheckBox, SIGNAL(toggled(bool)),
|
||||
m_secUi->clearClipboardSpinBox, SLOT(setEnabled(bool)));
|
||||
|
@ -302,6 +304,9 @@ void ApplicationSettingsWidget::loadSettings()
|
|||
showExpiredEntriesOnDatabaseUnlockToggled(m_generalUi->showExpiredEntriesOnDatabaseUnlockCheckBox->isChecked());
|
||||
|
||||
m_generalUi->autoTypeAskCheckBox->setChecked(config()->get(Config::Security_AutoTypeAsk).toBool());
|
||||
m_generalUi->autoTypeSkipMainWindowConfirmationCheckBox->setChecked(
|
||||
config()->get(Config::Security_AutoTypeSkipMainWindowConfirmation).toBool());
|
||||
autoTypeAskToggled(m_generalUi->autoTypeAskCheckBox->isChecked());
|
||||
m_generalUi->autoTypeRelockDatabaseCheckBox->setChecked(config()->get(Config::Security_RelockAutoType).toBool());
|
||||
|
||||
if (autoType()->isAvailable()) {
|
||||
|
@ -445,6 +450,8 @@ void ApplicationSettingsWidget::saveSettings()
|
|||
m_generalUi->showExpiredEntriesOnDatabaseUnlockOffsetSpinBox->value());
|
||||
|
||||
config()->set(Config::Security_AutoTypeAsk, m_generalUi->autoTypeAskCheckBox->isChecked());
|
||||
config()->set(Config::Security_AutoTypeSkipMainWindowConfirmation,
|
||||
m_generalUi->autoTypeSkipMainWindowConfirmationCheckBox->isChecked());
|
||||
config()->set(Config::Security_RelockAutoType, m_generalUi->autoTypeRelockDatabaseCheckBox->isChecked());
|
||||
|
||||
if (autoType()->isAvailable()) {
|
||||
|
@ -618,6 +625,11 @@ void ApplicationSettingsWidget::showExpiredEntriesOnDatabaseUnlockToggled(bool c
|
|||
m_generalUi->showExpiredEntriesOnDatabaseUnlockOffsetSpinBox->setEnabled(checked);
|
||||
}
|
||||
|
||||
void ApplicationSettingsWidget::autoTypeAskToggled(bool checked)
|
||||
{
|
||||
m_generalUi->autoTypeSkipMainWindowConfirmationCheckBox->setEnabled(checked);
|
||||
}
|
||||
|
||||
void ApplicationSettingsWidget::selectBackupDirectory()
|
||||
{
|
||||
auto backupDirectory =
|
||||
|
|
|
@ -63,6 +63,7 @@ private slots:
|
|||
void rememberDatabasesToggled(bool checked);
|
||||
void checkUpdatesToggled(bool checked);
|
||||
void showExpiredEntriesOnDatabaseUnlockToggled(bool checked);
|
||||
void autoTypeAskToggled(bool checked);
|
||||
void selectBackupDirectory();
|
||||
|
||||
private:
|
||||
|
|
|
@ -1157,6 +1157,42 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="autoTypeSkipMainWindowLayout">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<spacer name="autoTypeSkipMainWindowSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>30</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="autoTypeSkipMainWindowConfirmationCheckBox">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Skip confirmation for main window Auto-Type actions</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="autoTypeHideExpiredEntryCheckBox">
|
||||
<property name="text">
|
||||
|
|
|
@ -877,12 +877,18 @@ void DatabaseWidget::performAutoType(const QString& sequence)
|
|||
{
|
||||
auto currentEntry = currentSelectedEntry();
|
||||
if (currentEntry) {
|
||||
// TODO: Include name of previously active window in confirmation question
|
||||
if (config()->get(Config::Security_AutoTypeAsk).toBool()
|
||||
&& MessageBox::question(
|
||||
this, tr("Confirm Auto-Type"), tr("Perform Auto-Type into the previously active window?"))
|
||||
!= MessageBox::Yes) {
|
||||
return;
|
||||
// Check if we need to ask for confirmation
|
||||
bool shouldAsk = config()->get(Config::Security_AutoTypeAsk).toBool();
|
||||
bool skipMainWindowConfirmation = config()->get(Config::Security_AutoTypeSkipMainWindowConfirmation).toBool();
|
||||
|
||||
// Show confirmation if Security_AutoTypeAsk is true AND Security_AutoTypeSkipMainWindowConfirmation is false
|
||||
if (shouldAsk && !skipMainWindowConfirmation) {
|
||||
// TODO: Include name of previously active window in confirmation question
|
||||
if (MessageBox::question(
|
||||
this, tr("Confirm Auto-Type"), tr("Perform Auto-Type into the previously active window?"))
|
||||
!= MessageBox::Yes) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (sequence.isEmpty()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue