]> jfr.im git - irc/quakenet/qwebirc.git/blobdiff - qwebirc/engines/authgateengine.py
Add a much better QuakeNet login system.
[irc/quakenet/qwebirc.git] / qwebirc / engines / authgateengine.py
index bd097b6838ee3c7869bbfbde6fd0cdc9c01653cb..f4f29df7060bf1011b1314f21fe6270a00245349 100644 (file)
@@ -2,6 +2,7 @@ from twisted.web import resource, server, static
 import config, urlparse, urllib, hashlib, re
 import qwebirc.util.rijndael, qwebirc.util.ciphers
 import qwebirc.util
+import qwebirc.util.qjson as json
 
 authgate = config.AUTHGATEPROVIDER.twisted
 BLOCK_SIZE = 128/8
@@ -35,6 +36,10 @@ class AuthgateEngine(resource.Resource):
         getSessionData(request)["qticket"] = decodeQTicket(qt)
       
       self.__hit()
+      if request.getCookie("jslogin"):
+        self.deleteCookie(request, "jslogin")
+        return """<html><head><script>window.opener.__qwebircAuthCallback(%s);</script></head></html>""" % json.dumps(ticket.username)
+
       location = request.getCookie("redirect")
       if location is None:
         location = "/"
@@ -77,4 +82,4 @@ def getSessionData(request):
   
 def login_optional(request):
   return authgate(request, config.AUTHGATEDOMAIN).login_optional()
\ No newline at end of file