diff options
author | Jonathan White <support@dmapps.us> | 2021-05-30 15:48:28 +0300 |
---|---|---|
committer | Jonathan White <support@dmapps.us> | 2021-05-30 17:02:43 +0300 |
commit | 6ebd341ea41e2cf07ba217bda1be722fb300c948 (patch) | |
tree | 4a3737c6adcf51e49575013285551496c0806ee7 | |
parent | a22821921461ec19b5ed88dfa7cbdae0da88ec4c (diff) |
Add feature to ignore entries for HTTP-Auth Logins
* Backport to fix #6173
-rw-r--r-- | src/browser/BrowserService.cpp | 6 | ||||
-rw-r--r-- | src/browser/BrowserService.h | 1 | ||||
-rw-r--r-- | src/gui/EditWidget.cpp | 2 | ||||
-rw-r--r-- | src/gui/entry/EditEntryWidget.cpp | 11 | ||||
-rw-r--r-- | src/gui/entry/EditEntryWidgetBrowser.ui | 10 |
5 files changed, 29 insertions, 1 deletions
diff --git a/src/browser/BrowserService.cpp b/src/browser/BrowserService.cpp index 5e1173df4..703ef9612 100644 --- a/src/browser/BrowserService.cpp +++ b/src/browser/BrowserService.cpp @@ -55,6 +55,7 @@ static const QString KEEPASSHTTP_GROUP_NAME = QStringLiteral("KeePassHttp Passwo const QString BrowserService::OPTION_SKIP_AUTO_SUBMIT = QStringLiteral("BrowserSkipAutoSubmit"); const QString BrowserService::OPTION_HIDE_ENTRY = QStringLiteral("BrowserHideEntry"); const QString BrowserService::OPTION_ONLY_HTTP_AUTH = QStringLiteral("BrowserOnlyHttpAuth"); +const QString BrowserService::OPTION_NOT_HTTP_AUTH = QStringLiteral("BrowserNotHttpAuth"); // Multiple URL's const QString BrowserService::ADDITIONAL_URL = QStringLiteral("KP2A_URL"); @@ -397,6 +398,11 @@ QJsonArray BrowserService::findMatchingEntries(const QString& dbid, continue; } + if (httpAuth && entry->customData()->contains(BrowserService::OPTION_NOT_HTTP_AUTH) + && entry->customData()->value(BrowserService::OPTION_NOT_HTTP_AUTH) == TRUE_STR) { + continue; + } + // HTTP Basic Auth always needs a confirmation if (!ignoreHttpAuth && httpAuth) { pwEntriesToConfirm.append(entry); diff --git a/src/browser/BrowserService.h b/src/browser/BrowserService.h index f84bf2880..d45556a73 100644 --- a/src/browser/BrowserService.h +++ b/src/browser/BrowserService.h @@ -90,6 +90,7 @@ public: static const QString OPTION_SKIP_AUTO_SUBMIT; static const QString OPTION_HIDE_ENTRY; static const QString OPTION_ONLY_HTTP_AUTH; + static const QString OPTION_NOT_HTTP_AUTH; static const QString ADDITIONAL_URL; signals: diff --git a/src/gui/EditWidget.cpp b/src/gui/EditWidget.cpp index fbd07a82e..c916582d2 100644 --- a/src/gui/EditWidget.cpp +++ b/src/gui/EditWidget.cpp @@ -102,7 +102,7 @@ void EditWidget::setPageHidden(QWidget* widget, bool hidden) m_ui->categoryList->setCategoryHidden(index, hidden); } - if (index == m_ui->stackedWidget->currentIndex()) { + if (hidden && index == m_ui->stackedWidget->currentIndex()) { int newIndex = m_ui->stackedWidget->currentIndex() - 1; if (newIndex < 0) { newIndex = m_ui->stackedWidget->count() - 1; diff --git a/src/gui/entry/EditEntryWidget.cpp b/src/gui/entry/EditEntryWidget.cpp index c4de82973..93b5943b4 100644 --- a/src/gui/entry/EditEntryWidget.cpp +++ b/src/gui/entry/EditEntryWidget.cpp @@ -279,6 +279,7 @@ void EditEntryWidget::setupBrowser() connect(m_browserUi->skipAutoSubmitCheckbox, SIGNAL(toggled(bool)), SLOT(updateBrowserModified())); connect(m_browserUi->hideEntryCheckbox, SIGNAL(toggled(bool)), SLOT(updateBrowserModified())); connect(m_browserUi->onlyHttpAuthCheckbox, SIGNAL(toggled(bool)), SLOT(updateBrowserModified())); + connect(m_browserUi->notHttpAuthCheckbox, SIGNAL(toggled(bool)), SLOT(updateBrowserModified())); connect(m_browserUi->addURLButton, SIGNAL(clicked()), SLOT(insertURL())); connect(m_browserUi->removeURLButton, SIGNAL(clicked()), SLOT(removeCurrentURL())); connect(m_browserUi->editURLButton, SIGNAL(clicked()), SLOT(editCurrentURL())); @@ -306,9 +307,11 @@ void EditEntryWidget::updateBrowser() auto skip = m_browserUi->skipAutoSubmitCheckbox->isChecked(); auto hide = m_browserUi->hideEntryCheckbox->isChecked(); auto onlyHttpAuth = m_browserUi->onlyHttpAuthCheckbox->isChecked(); + auto notHttpAuth = m_browserUi->notHttpAuthCheckbox->isChecked(); m_customData->set(BrowserService::OPTION_SKIP_AUTO_SUBMIT, (skip ? TRUE_STR : FALSE_STR)); m_customData->set(BrowserService::OPTION_HIDE_ENTRY, (hide ? TRUE_STR : FALSE_STR)); m_customData->set(BrowserService::OPTION_ONLY_HTTP_AUTH, (onlyHttpAuth ? TRUE_STR : FALSE_STR)); + m_customData->set(BrowserService::OPTION_NOT_HTTP_AUTH, (notHttpAuth ? TRUE_STR : FALSE_STR)); } void EditEntryWidget::insertURL() @@ -473,6 +476,7 @@ void EditEntryWidget::setupEntryUpdate() connect(m_browserUi->skipAutoSubmitCheckbox, SIGNAL(toggled(bool)), SLOT(setModified())); connect(m_browserUi->hideEntryCheckbox, SIGNAL(toggled(bool)), SLOT(setModified())); connect(m_browserUi->onlyHttpAuthCheckbox, SIGNAL(toggled(bool)), SLOT(setModified())); + connect(m_browserUi->notHttpAuthCheckbox, SIGNAL(toggled(bool)), SLOT(setModified())); connect(m_browserUi->addURLButton, SIGNAL(toggled(bool)), SLOT(setModified())); connect(m_browserUi->removeURLButton, SIGNAL(toggled(bool)), SLOT(setModified())); connect(m_browserUi->editURLButton, SIGNAL(toggled(bool)), SLOT(setModified())); @@ -958,6 +962,13 @@ void EditEntryWidget::setForms(Entry* entry, bool restore) m_browserUi->onlyHttpAuthCheckbox->setChecked(false); } + if (m_customData->contains(BrowserService::OPTION_NOT_HTTP_AUTH)) { + m_browserUi->notHttpAuthCheckbox->setChecked(m_customData->value(BrowserService::OPTION_NOT_HTTP_AUTH) + == TRUE_STR); + } else { + m_browserUi->notHttpAuthCheckbox->setChecked(false); + } + m_browserUi->addURLButton->setEnabled(!m_history); m_browserUi->removeURLButton->setEnabled(false); m_browserUi->editURLButton->setEnabled(false); diff --git a/src/gui/entry/EditEntryWidgetBrowser.ui b/src/gui/entry/EditEntryWidgetBrowser.ui index 9d1e0f511..5f117e987 100644 --- a/src/gui/entry/EditEntryWidgetBrowser.ui +++ b/src/gui/entry/EditEntryWidgetBrowser.ui @@ -60,6 +60,16 @@ </property> </widget> </item> + <item> + <widget class="QCheckBox" name="notHttpAuthCheckbox"> + <property name="toolTip"> + <string>Do not send this setting to the browser for HTTP Auth dialogs. If enabled, HTTP Auth dialogs will not show this entry for selection.</string> + </property> + <property name="text"> + <string>Do not use this entry with HTTP Basic Auth</string> + </property> + </widget> + </item> </layout> </widget> </item> |