X-Git-Url: https://gitweb.stoutner.com/?p=PrivacyBrowserPC.git;a=blobdiff_plain;f=src%2Fwidgets%2FPrivacyWebEngineView.cpp;fp=src%2Fwidgets%2FPrivacyWebEngineView.cpp;h=42c331fec5340447ed05da6433a6475db30f7de4;hp=6080288e4f5b4238404e8e13795e305f2fd9c65e;hb=ce90749b5fc2c4a3fcee6daee60c0d6e2aa0e1d6;hpb=3ea5ede1fd0721bea6813f36388ba6387bdbfcfe diff --git a/src/widgets/PrivacyWebEngineView.cpp b/src/widgets/PrivacyWebEngineView.cpp index 6080288..42c331f 100644 --- a/src/widgets/PrivacyWebEngineView.cpp +++ b/src/widgets/PrivacyWebEngineView.cpp @@ -221,6 +221,9 @@ void PrivacyWebEngineView::applyDomainSettings(const QString &hostname, const bo if (reloadWebsite) reload(); + // Reset the HTTP authentication dialog counter. + httpAuthenticationDialogsDisplayed = 0; + // Update the UI. emit updateUi(this); } @@ -305,11 +308,17 @@ void PrivacyWebEngineView::displayHttpPingDialog(const QString &httpPingUrl) con void PrivacyWebEngineView::handleAuthenticationRequest(const QUrl &requestUrl, QAuthenticator *authenticatorPointer) { - // Instantiate an HTTP authentication dialog. - HttpAuthenticationDialog *httpAuthenticationDialogPointer = new HttpAuthenticationDialog(parentWidget(), requestUrl, authenticatorPointer); + // Only display the HTTP authentication dialog if it hasn't already been displayed three times for this URL. + if (httpAuthenticationDialogsDisplayed < 3) { + // Increment the HTTP authentication dialog display counter. + ++httpAuthenticationDialogsDisplayed; + + // Instantiate an HTTP authentication dialog. + HttpAuthenticationDialog *httpAuthenticationDialogPointer = new HttpAuthenticationDialog(parentWidget(), requestUrl, authenticatorPointer); - // Display the dialog. This must be `exec()` instead of `show()` so that the website doesn't proceed before populating the authentication pointer. - httpAuthenticationDialogPointer->exec(); + // Display the dialog. This must be `exec()` instead of `show()` so that the website doesn't proceed before populating the authentication pointer. + httpAuthenticationDialogPointer->exec(); + } } void PrivacyWebEngineView::removeCookieFromList(const QNetworkCookie &cookie) const