13 |
13 |
14 from PyQt5.QtCore import pyqtSignal, QByteArray |
14 from PyQt5.QtCore import pyqtSignal, QByteArray |
15 from PyQt5.QtWidgets import qApp, QStyle, QDialog |
15 from PyQt5.QtWidgets import qApp, QStyle, QDialog |
16 from PyQt5.QtNetwork import QNetworkAccessManager, QNetworkProxy, \ |
16 from PyQt5.QtNetwork import QNetworkAccessManager, QNetworkProxy, \ |
17 QNetworkProxyFactory, QNetworkRequest |
17 QNetworkProxyFactory, QNetworkRequest |
18 from PyQt5.QtWebEngineWidgets import QWebEnginePage |
|
19 |
18 |
20 from E5Gui import E5MessageBox |
19 from E5Gui import E5MessageBox |
21 |
20 |
22 from E5Network.E5NetworkProxyFactory import proxyAuthenticationRequired |
21 from E5Network.E5NetworkProxyFactory import proxyAuthenticationRequired |
23 try: |
22 try: |
208 self.__temporarilyIgnoredSslErrors[host].append(error.error()) |
207 self.__temporarilyIgnoredSslErrors[host].append(error.error()) |
209 return True |
208 return True |
210 else: |
209 else: |
211 return False |
210 return False |
212 |
211 |
213 def authentication(self, url, auth): |
212 def authentication(self, url, auth, page=None): |
214 """ |
213 """ |
215 Public slot to handle an authentication request. |
214 Public slot to handle an authentication request. |
216 |
215 |
217 @param url URL requesting authentication (QUrl) |
216 @param url URL requesting authentication |
218 @param auth reference to the authenticator object (QAuthenticator) |
217 @type QUrl |
|
218 @param auth reference to the authenticator object |
|
219 @type QAuthenticator |
|
220 @param page reference to the web page |
|
221 @type QWebEnginePage or None |
219 """ |
222 """ |
220 urlRoot = "{0}://{1}"\ |
223 urlRoot = "{0}://{1}"\ |
221 .format(url.scheme(), url.authority()) |
224 .format(url.scheme(), url.authority()) |
222 realm = auth.realm() |
225 realm = auth.realm() |
223 if not realm and 'realm' in auth.options(): |
226 if not realm and 'realm' in auth.options(): |
247 auth.setPassword(password) |
250 auth.setPassword(password) |
248 if Preferences.getUser("SavePasswords") and dlg.shallSave(): |
251 if Preferences.getUser("SavePasswords") and dlg.shallSave(): |
249 WebBrowser.WebBrowserWindow.WebBrowserWindow.passwordManager()\ |
252 WebBrowser.WebBrowserWindow.WebBrowserWindow.passwordManager()\ |
250 .setLogin(url, realm, username, password) |
253 .setLogin(url, realm, username, password) |
251 else: |
254 else: |
252 page = self.sender() |
255 if page is not None: |
253 if isinstance(page, QWebEnginePage): |
|
254 self.__showAuthenticationErrorPage(page, url) |
256 self.__showAuthenticationErrorPage(page, url) |
255 |
257 |
256 def __showAuthenticationErrorPage(self, page, url): |
258 def __showAuthenticationErrorPage(self, page, url): |
257 """ |
259 """ |
258 Private method to show an authentication error page. |
260 Private method to show an authentication error page. |