Move to a central login() method

This commit is contained in:
Ryan Holmes
2018-03-17 20:23:14 -04:00
parent 00e8e9d84a
commit 033647da61
4 changed files with 10 additions and 4 deletions

View File

@@ -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()

View File

@@ -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()

View File

@@ -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()

View File

@@ -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()