Better handle user dismissing the verifaction dialog.

This commit is contained in:
Jonathan Harris committed 2015-09-15 12:51:52 +01:00
1 parent a1a1a17987
commit 33c88e5fbf
3 files changed
+9

No files matched your search

+1
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
+2
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
+6
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)