Add a couple of bug fixes, and make the server option a checkbox

This commit is contained in:
blitzmann
2022-05-08 13:48:38 -04:00
parent ed48a8b5d0
commit 27101732ca
3 changed files with 24 additions and 21 deletions

View File

@@ -43,26 +43,22 @@ class PFEsiPref(PreferenceView):
"due to 'Signature has expired' error")))
mainSizer.Add(self.enforceJwtExpiration, 0, wx.ALL | wx.EXPAND, 5)
self.ssoServer = wx.CheckBox(panel, wx.ID_ANY, _t("Auto-login (starts local server)"), wx.DefaultPosition,
wx.DefaultSize,
0)
self.ssoServer.SetToolTip(wx.ToolTip(_t("This allows the EVE SSO to callback to your local pyfa instance and complete the authentication process without manual intervention.")))
mainSizer.Add(self.ssoServer, 0, wx.ALL | wx.EXPAND, 5)
rbSizer = wx.BoxSizer(wx.HORIZONTAL)
self.rbMode = wx.RadioBox(panel, -1, _t("Login Authentication Method"), wx.DefaultPosition, wx.DefaultSize,
[_t('Local Server'), _t('Manual')], 1, wx.RA_SPECIFY_COLS)
self.rbMode.SetItemToolTip(0, _t("This option starts a local webserver that EVE SSO Server will call back to"
" with information about the character login."))
self.rbMode.SetItemToolTip(1, _t("This option prompts users to copy and paste information to allow for"
" character login. Use this if having issues with the local server."))
self.rbMode.SetSelection(self.settings.get('loginMode'))
self.enforceJwtExpiration.SetValue(self.settings.get("enforceJwtExpiration" or True))
rbSizer.Add(self.rbMode, 1, wx.TOP | wx.RIGHT, 5)
self.rbMode.Bind(wx.EVT_RADIOBOX, self.OnModeChange)
self.enforceJwtExpiration.SetValue(self.settings.get("enforceJwtExpiration") or True)
self.ssoServer.SetValue(True if self.settings.get("loginMode") == 0 else False)
mainSizer.Add(rbSizer, 0, wx.ALL | wx.EXPAND, 0)
esiSizer = wx.BoxSizer(wx.HORIZONTAL)
self.esiServer = wx.StaticText(panel, wx.ID_ANY, _t("Default SSO Server:"), wx.DefaultPosition,wx.DefaultSize, 0)
self.esiServer = wx.StaticText(panel, wx.ID_ANY, _t("Default SSO Server:"), wx.DefaultPosition, wx.DefaultSize, 0)
self.esiServer.Wrap(-1)
@@ -76,10 +72,12 @@ class PFEsiPref(PreferenceView):
esiSizer.Add(self.chESIserver, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 10)
mainSizer.Add(esiSizer, 0, wx.TOP | wx.RIGHT , 10)
mainSizer.Add(esiSizer, 0, wx.TOP | wx.RIGHT, 10)
self.chESIserver.Bind(wx.EVT_CHOICE, self.OnServerChange)
self.enforceJwtExpiration.Bind(wx.EVT_CHECKBOX, self.OnEnforceChange)
self.ssoServer.Bind(wx.EVT_CHECKBOX, self.OnModeChange)
mainSizer.Add(rbSizer, 1, wx.ALL | wx.EXPAND, 0)
panel.SetSizer(mainSizer)
@@ -88,19 +86,23 @@ class PFEsiPref(PreferenceView):
def OnTimeoutChange(self, event):
self.settings.set('timeout', event.GetEventObject().GetValue())
event.Skip()
def OnModeChange(self, event):
self.settings.set('loginMode', event.GetInt())
self.settings.set('loginMode', 0 if self.ssoServer.GetValue() else 1)
event.Skip()
def OnEnforceChange(self, event):
self.settings.set('enforceJwtExpiration', self.enforceJwtExpiration.GetValue())
event.Skip()
def OnServerChange(self, event):
source = self.chESIserver.GetString(self.chESIserver.GetSelection())
esiService = Esi.getInstance()
esiService.init(config.supported_servers[source])
self.settings.set("server", source)
pass
# source = self.chESIserver.GetString(self.chESIserver.GetSelection())
# esiService = Esi.getInstance()
# # esiService.init(config.supported_servers[source])
# self.settings.set("server", source)
# event.Skip()
def getImage(self):
return BitmapLoader.getBitmap("eve", "gui")

View File

@@ -88,6 +88,7 @@ class SsoLogin(wx.Dialog):
def OnDestroy(self, event):
# Clean up by unbinding some events and stopping the server
self.mainFrame.Unbind(GE.EVT_SSO_LOGIN, handler=self.OnLogin)
self.Unbind(wx.EVT_WINDOW_DESTROY, handler=self.OnDestroy)
if self:
self.Unbind(wx.EVT_WINDOW_DESTROY, handler=self.OnDestroy)
self.sEsi.stopServer()
event.Skip()

View File

@@ -108,7 +108,7 @@ class Esi(EsiAccess):
from gui.esiFittings import ESIExceptionHandler
try:
if self.default_server_name == "Serenity":
if self.server_name == "Serenity":
s = re.search(r'(?<=code=)[a-zA-Z0-9\-_]*', dlg.ssoInfoCtrl.Value.strip())
if s:
# skip state verification and go directly through the auth code processing