diff --git a/service/server.py b/service/server.py index c75892d70..e4325a69c 100644 --- a/service/server.py +++ b/service/server.py @@ -34,6 +34,7 @@ HTML = '''

pyfa

{0} + @@ -61,14 +73,20 @@ class AuthHandler(BaseHTTPServer.BaseHTTPRequestHandler): def do_GET(self): if self.path == "/favicon.ico": return + parsed_path = urlparse.urlparse(self.path) parts = urlparse.parse_qs(parsed_path.query) - msg = "" + step2 = 'step' in parts + try: - self.server.callback(parts) - msg = "If you see this message then it means you should be logged into CREST. You may close this window and return to the application." + if step2: + self.server.callback(parts) + msg = "If you see this message then it means you should be logged into CREST. You may close this window and return to the application." + else: + # For implicit mode, we have to serve up the page which will take the hash and redirect useing a querystring + msg = "Processing response from EVE Online" except Exception, ex: msg = "

Error

\n

{}

".format(ex.message) finally: @@ -76,7 +94,9 @@ class AuthHandler(BaseHTTPServer.BaseHTTPRequestHandler): self.end_headers() self.wfile.write(HTML.format(msg)) - self.server.stop() + if step2: + # Only stop once if we've received something in the querystring + self.server.stop() def log_message(self, format, *args): return