From 033647da61f5fd97f340fa255946140d502ed224 Mon Sep 17 00:00:00 2001 From: Ryan Holmes Date: Sat, 17 Mar 2018 20:23:14 -0400 Subject: [PATCH] Move to a central login() method --- gui/characterEditor.py | 3 +-- gui/esiFittings.py | 3 +-- gui/globalEvents.py | 1 + service/esi.py | 7 +++++++ 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/gui/characterEditor.py b/gui/characterEditor.py index 65dcb408f..c7a2fef8c 100644 --- a/gui/characterEditor.py +++ b/gui/characterEditor.py @@ -781,8 +781,7 @@ class APIView(wx.Panel): def addCharacter(self, event): sEsi = Esi.getInstance() - uri = sEsi.startServer() - webbrowser.open(uri) + sEsi.login() def getActiveCharacter(self): selection = self.charChoice.GetCurrentSelection() diff --git a/gui/esiFittings.py b/gui/esiFittings.py index 2d8c5f9fa..31fdd5a71 100644 --- a/gui/esiFittings.py +++ b/gui/esiFittings.py @@ -344,8 +344,7 @@ class SsoCharacterMgmt(wx.Dialog): @staticmethod def addChar(event): sEsi = Esi.getInstance() - uri = sEsi.startServer() - webbrowser.open(uri) + sEsi.login() def delChar(self, event): item = self.lcCharacters.GetFirstSelected() diff --git a/gui/globalEvents.py b/gui/globalEvents.py index 1c1cc7e38..53784fcb6 100644 --- a/gui/globalEvents.py +++ b/gui/globalEvents.py @@ -5,5 +5,6 @@ FitChanged, FIT_CHANGED = wx.lib.newevent.NewEvent() CharListUpdated, CHAR_LIST_UPDATED = wx.lib.newevent.NewEvent() CharChanged, CHAR_CHANGED = wx.lib.newevent.NewEvent() +SsoLoggingIn, EVT_SSO_LOGGING_IN = wx.lib.newevent.NewEvent() SsoLogin, EVT_SSO_LOGIN = wx.lib.newevent.NewEvent() SsoLogout, EVT_SSO_LOGOUT = wx.lib.newevent.NewEvent() diff --git a/service/esi.py b/service/esi.py index f76f288d5..cd7879575 100644 --- a/service/esi.py +++ b/service/esi.py @@ -9,6 +9,7 @@ import base64 import json import os import config +import webbrowser import eos.db import datetime @@ -179,6 +180,12 @@ class Esi(object): if char.esi_client is not None: char.esi_client.security.update_token(tokenResponse) + def login(self): + # Switch off how we do things here depending on the mode of authentication + uri = self.startServer() + webbrowser.open(uri) + wx.PostEvent(self.mainFrame, GE.SsoLoggingIn()) + def stopServer(self): pyfalog.debug("Stopping Server") self.httpd.stop()