1
0
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:
Jonathan Harris 2015-09-15 12:50:38 +01:00
parent a1a1a17987
commit 33c88e5fbf
3 changed files with 9 additions and 0 deletions

View File

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

View File

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

View File

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