Skip to content

Commit 2710173

Browse files
committed
Add a couple of bug fixes, and make the server option a checkbox
1 parent ed48a8b commit 2710173

File tree

3 files changed

+24
-21
lines changed

3 files changed

+24
-21
lines changed

gui/builtinPreferenceViews/pyfaEsiPreferences.py

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -43,26 +43,22 @@ def populatePanel(self, panel):
4343
"due to 'Signature has expired' error")))
4444
mainSizer.Add(self.enforceJwtExpiration, 0, wx.ALL | wx.EXPAND, 5)
4545

46-
rbSizer = wx.BoxSizer(wx.HORIZONTAL)
47-
self.rbMode = wx.RadioBox(panel, -1, _t("Login Authentication Method"), wx.DefaultPosition, wx.DefaultSize,
48-
[_t('Local Server'), _t('Manual')], 1, wx.RA_SPECIFY_COLS)
49-
self.rbMode.SetItemToolTip(0, _t("This option starts a local webserver that EVE SSO Server will call back to"
50-
" with information about the character login."))
51-
self.rbMode.SetItemToolTip(1, _t("This option prompts users to copy and paste information to allow for"
52-
" character login. Use this if having issues with the local server."))
53-
54-
self.rbMode.SetSelection(self.settings.get('loginMode'))
55-
self.enforceJwtExpiration.SetValue(self.settings.get("enforceJwtExpiration" or True))
46+
self.ssoServer = wx.CheckBox(panel, wx.ID_ANY, _t("Auto-login (starts local server)"), wx.DefaultPosition,
47+
wx.DefaultSize,
48+
0)
49+
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.")))
50+
mainSizer.Add(self.ssoServer, 0, wx.ALL | wx.EXPAND, 5)
5651

57-
rbSizer.Add(self.rbMode, 1, wx.TOP | wx.RIGHT, 5)
52+
rbSizer = wx.BoxSizer(wx.HORIZONTAL)
5853

59-
self.rbMode.Bind(wx.EVT_RADIOBOX, self.OnModeChange)
54+
self.enforceJwtExpiration.SetValue(self.settings.get("enforceJwtExpiration") or True)
55+
self.ssoServer.SetValue(True if self.settings.get("loginMode") == 0 else False)
6056

6157
mainSizer.Add(rbSizer, 0, wx.ALL | wx.EXPAND, 0)
6258

6359
esiSizer = wx.BoxSizer(wx.HORIZONTAL)
6460

65-
self.esiServer = wx.StaticText(panel, wx.ID_ANY, _t("Default SSO Server:"), wx.DefaultPosition,wx.DefaultSize, 0)
61+
self.esiServer = wx.StaticText(panel, wx.ID_ANY, _t("Default SSO Server:"), wx.DefaultPosition, wx.DefaultSize, 0)
6662

6763
self.esiServer.Wrap(-1)
6864

@@ -76,10 +72,12 @@ def populatePanel(self, panel):
7672

7773
esiSizer.Add(self.chESIserver, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 10)
7874

79-
mainSizer.Add(esiSizer, 0, wx.TOP | wx.RIGHT , 10)
75+
mainSizer.Add(esiSizer, 0, wx.TOP | wx.RIGHT, 10)
8076

8177
self.chESIserver.Bind(wx.EVT_CHOICE, self.OnServerChange)
8278
self.enforceJwtExpiration.Bind(wx.EVT_CHECKBOX, self.OnEnforceChange)
79+
self.ssoServer.Bind(wx.EVT_CHECKBOX, self.OnModeChange)
80+
8381
mainSizer.Add(rbSizer, 1, wx.ALL | wx.EXPAND, 0)
8482

8583
panel.SetSizer(mainSizer)
@@ -88,19 +86,23 @@ def populatePanel(self, panel):
8886

8987
def OnTimeoutChange(self, event):
9088
self.settings.set('timeout', event.GetEventObject().GetValue())
89+
event.Skip()
9190

9291
def OnModeChange(self, event):
93-
self.settings.set('loginMode', event.GetInt())
92+
self.settings.set('loginMode', 0 if self.ssoServer.GetValue() else 1)
93+
event.Skip()
9494

9595
def OnEnforceChange(self, event):
9696
self.settings.set('enforceJwtExpiration', self.enforceJwtExpiration.GetValue())
9797
event.Skip()
9898

9999
def OnServerChange(self, event):
100-
source = self.chESIserver.GetString(self.chESIserver.GetSelection())
101-
esiService = Esi.getInstance()
102-
esiService.init(config.supported_servers[source])
103-
self.settings.set("server", source)
100+
pass
101+
# source = self.chESIserver.GetString(self.chESIserver.GetSelection())
102+
# esiService = Esi.getInstance()
103+
# # esiService.init(config.supported_servers[source])
104+
# self.settings.set("server", source)
105+
# event.Skip()
104106

105107
def getImage(self):
106108
return BitmapLoader.getBitmap("eve", "gui")

gui/ssoLogin.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ def OnLogin(self, event):
8888
def OnDestroy(self, event):
8989
# Clean up by unbinding some events and stopping the server
9090
self.mainFrame.Unbind(GE.EVT_SSO_LOGIN, handler=self.OnLogin)
91-
self.Unbind(wx.EVT_WINDOW_DESTROY, handler=self.OnDestroy)
91+
if self:
92+
self.Unbind(wx.EVT_WINDOW_DESTROY, handler=self.OnDestroy)
9293
self.sEsi.stopServer()
9394
event.Skip()

service/esi.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ def login(self):
108108
from gui.esiFittings import ESIExceptionHandler
109109

110110
try:
111-
if self.default_server_name == "Serenity":
111+
if self.server_name == "Serenity":
112112
s = re.search(r'(?<=code=)[a-zA-Z0-9\-_]*', dlg.ssoInfoCtrl.Value.strip())
113113
if s:
114114
# skip state verification and go directly through the auth code processing

0 commit comments

Comments
 (0)