From bee861ff8f2c822c6daa4960a1bb25362bf30a28 Mon Sep 17 00:00:00 2001 From: varjolintu Date: Sat, 19 Oct 2019 15:10:50 +0300 Subject: [PATCH] Browser access control dialog shows submitUrl when found --- src/browser/BrowserService.cpp | 7 ++++--- src/browser/BrowserService.h | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/browser/BrowserService.cpp b/src/browser/BrowserService.cpp index 8a6ad0ec5..b20d78705 100644 --- a/src/browser/BrowserService.cpp +++ b/src/browser/BrowserService.cpp @@ -410,7 +410,7 @@ QJsonArray BrowserService::findMatchingEntries(const QString& id, } // Confirm entries - if (confirmEntries(pwEntriesToConfirm, url, host, submitHost, realm, httpAuth)) { + if (confirmEntries(pwEntriesToConfirm, url, host, submitUrl, realm, httpAuth)) { pwEntries.append(pwEntriesToConfirm); } @@ -786,7 +786,7 @@ QList BrowserService::sortEntries(QList& pwEntries, const QStrin bool BrowserService::confirmEntries(QList& pwEntriesToConfirm, const QString& url, const QString& host, - const QString& submitHost, + const QString& submitUrl, const QString& realm, const bool httpAuth) { @@ -797,7 +797,7 @@ bool BrowserService::confirmEntries(QList& pwEntriesToConfirm, m_dialogActive = true; BrowserAccessControlDialog accessControlDialog; connect(m_dbTabWidget, SIGNAL(databaseLocked(DatabaseWidget*)), &accessControlDialog, SLOT(reject())); - accessControlDialog.setUrl(url); + accessControlDialog.setUrl(!submitUrl.isEmpty() ? submitUrl : url); accessControlDialog.setItems(pwEntriesToConfirm); accessControlDialog.setHTTPAuth(httpAuth); @@ -806,6 +806,7 @@ bool BrowserService::confirmEntries(QList& pwEntriesToConfirm, accessControlDialog.activateWindow(); accessControlDialog.raise(); + const QString submitHost = QUrl(submitUrl).host(); int res = accessControlDialog.exec(); if (accessControlDialog.remember()) { for (auto* entry : pwEntriesToConfirm) { diff --git a/src/browser/BrowserService.h b/src/browser/BrowserService.h index a18a97448..81d3ed317 100644 --- a/src/browser/BrowserService.h +++ b/src/browser/BrowserService.h @@ -120,7 +120,7 @@ private: bool confirmEntries(QList& pwEntriesToConfirm, const QString& url, const QString& host, - const QString& submitHost, + const QString& submitUrl, const QString& realm, const bool httpAuth); QJsonObject prepareEntry(const Entry* entry);