fixed problems with tent.is and campr.me authentifications
This commit is contained in:
parent
a1e3816d0f
commit
ce3a42dbee
3 changed files with 19 additions and 4 deletions
|
@ -15,6 +15,10 @@ class Bungloo:
|
|||
|
||||
def __init__(self):
|
||||
|
||||
sslConfig = QtNetwork.QSslConfiguration.defaultConfiguration()
|
||||
sslConfig.setProtocol(QtNetwork.QSsl.TlsV1)
|
||||
QtNetwork.QSslConfiguration.setDefaultConfiguration(sslConfig)
|
||||
|
||||
self.app = QtGui.QApplication(sys.argv)
|
||||
self.new_message_windows = []
|
||||
self.controller = Controller(self)
|
||||
|
|
|
@ -2,7 +2,7 @@ from PyQt4 import QtCore, QtGui, QtWebKit
|
|||
|
||||
from PyQt4.QtCore import QTimer, QVariant, SIGNAL
|
||||
from PyQt4.QtGui import *
|
||||
from PyQt4.QtNetwork import QNetworkAccessManager, QNetworkRequest, QNetworkReply
|
||||
from PyQt4.QtNetwork import QNetworkAccessManager, QNetworkRequest, QNetworkReply, QSslSocket
|
||||
from PyQt4.QtWebKit import QWebView
|
||||
|
||||
import os, sys
|
||||
|
@ -107,8 +107,9 @@ class WebViewCreator(QtWebKit.QWebView):
|
|||
|
||||
def handleSslErrors(self, reply, errors):
|
||||
if os.name == "nt": # ignore SSL errors on Windows (yes a uggly workaround, don't know how to fix it yet)
|
||||
reply.ignoreSslErrors()
|
||||
pass
|
||||
for error in errors:
|
||||
print error.errorString()
|
||||
reply.ignoreSslErrors(errors)
|
||||
|
||||
|
||||
class NetworkAccessManager(QNetworkAccessManager):
|
||||
|
@ -123,6 +124,7 @@ class NetworkAccessManager(QNetworkAccessManager):
|
|||
self.setCookieJar(old_manager.cookieJar())
|
||||
self.setProxy(old_manager.proxy())
|
||||
self.setProxyFactory(old_manager.proxyFactory())
|
||||
self.sslErrors.connect(lambda reply, errors: old_manager.sslErrors)
|
||||
|
||||
def createRequest(self, operation, request, data):
|
||||
if request.url().scheme() != "bungloo":
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
from PyQt4 import QtCore, QtGui, QtWebKit
|
||||
import Helper, urllib, urllib2
|
||||
import Helper, urllib, urllib2, os
|
||||
|
||||
class Preferences:
|
||||
|
||||
|
@ -224,8 +224,10 @@ class Oauth:
|
|||
old_manager = self.auth_view.page().networkAccessManager()
|
||||
new_manager = Helper.NetworkAccessManager(old_manager, self.bungloo_callback)
|
||||
new_manager.authenticationRequired.connect(self.authentication_required)
|
||||
new_manager.sslErrors.connect(lambda reply, errors: self.handleSslErrors(reply, errors))
|
||||
self.auth_view.page().setNetworkAccessManager(new_manager)
|
||||
self.auth_view.show()
|
||||
|
||||
self.auth_view.load_url(url)
|
||||
return False
|
||||
|
||||
|
@ -250,6 +252,13 @@ class Oauth:
|
|||
if hasattr(self, "auth_view"):
|
||||
self.auth_view.hide()
|
||||
|
||||
def handleSslErrors(self, reply, errors):
|
||||
if os.name == "nt": # ignore SSL errors on Windows (yes a uggly workaround, don't know how to fix it yet)
|
||||
for error in errors:
|
||||
print error.errorString()
|
||||
reply.ignoreSslErrors(errors)
|
||||
|
||||
|
||||
|
||||
class Login(QtGui.QDialog):
|
||||
def __init__(self):
|
||||
|
|
Reference in a new issue