mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-06-02 16:41:04 +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)
|
self.session.verify(code)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
if __debug__: print_exc()
|
if __debug__: print_exc()
|
||||||
|
self.button['state'] = tk.NORMAL
|
||||||
self.status['text'] = unicode(e)
|
self.status['text'] = unicode(e)
|
||||||
else:
|
else:
|
||||||
return self.getandsend() # try again
|
return self.getandsend() # try again
|
||||||
|
@ -166,6 +166,8 @@ class Session:
|
|||||||
return r.status_code
|
return r.status_code
|
||||||
|
|
||||||
def verify(self, code):
|
def verify(self, code):
|
||||||
|
if not code:
|
||||||
|
raise VerificationRequired()
|
||||||
r = self.session.post(URL_CONFIRM, data = {'code' : code}, timeout=timeout)
|
r = self.session.post(URL_CONFIRM, data = {'code' : code}, timeout=timeout)
|
||||||
r.raise_for_status()
|
r.raise_for_status()
|
||||||
# verification doesn't actually return a yes/no, so log in again to determine state
|
# 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():
|
for child in frame.winfo_children():
|
||||||
child.grid_configure(padx=5, pady=5)
|
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
|
# wait for window to appear on screen before calling grab_set
|
||||||
self.wait_visibility()
|
self.wait_visibility()
|
||||||
self.grab_set()
|
self.grab_set()
|
||||||
@ -344,3 +346,7 @@ class AuthenticationDialog(tk.Toplevel):
|
|||||||
code = self.code.get().strip()
|
code = self.code.get().strip()
|
||||||
self.destroy()
|
self.destroy()
|
||||||
if self.callback: self.callback(code)
|
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