mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-04-14 08:17:13 +03:00
Better handle user dismissing the verifaction dialog.
This commit is contained in:
parent
a1a1a17987
commit
33c88e5fbf
@ -226,6 +226,7 @@ class AppWindow:
|
||||
self.session.verify(code)
|
||||
except Exception as e:
|
||||
if __debug__: print_exc()
|
||||
self.button['state'] = tk.NORMAL
|
||||
self.status['text'] = unicode(e)
|
||||
else:
|
||||
return self.getandsend() # try again
|
||||
|
@ -166,6 +166,8 @@ class Session:
|
||||
return r.status_code
|
||||
|
||||
def verify(self, code):
|
||||
if not code:
|
||||
raise VerificationRequired()
|
||||
r = self.session.post(URL_CONFIRM, data = {'code' : code}, timeout=timeout)
|
||||
r.raise_for_status()
|
||||
# verification doesn't actually return a yes/no, so log in again to determine state
|
||||
|
6
prefs.py
6
prefs.py
@ -331,6 +331,8 @@ class AuthenticationDialog(tk.Toplevel):
|
||||
for child in frame.winfo_children():
|
||||
child.grid_configure(padx=5, pady=5)
|
||||
|
||||
self.protocol("WM_DELETE_WINDOW", self._destroy)
|
||||
|
||||
# wait for window to appear on screen before calling grab_set
|
||||
self.wait_visibility()
|
||||
self.grab_set()
|
||||
@ -344,3 +346,7 @@ class AuthenticationDialog(tk.Toplevel):
|
||||
code = self.code.get().strip()
|
||||
self.destroy()
|
||||
if self.callback: self.callback(code)
|
||||
|
||||
def _destroy(self):
|
||||
self.destroy()
|
||||
if self.callback: self.callback(None)
|
||||
|
Loading…
x
Reference in New Issue
Block a user