Get back to PIN code authorization due to Twitter changes. Closes #216

This commit is contained in:
2018-06-06 09:11:37 -05:00
parent c2d81279fe
commit 9847f7ad01
3 changed files with 16 additions and 21 deletions

View File

@@ -167,19 +167,19 @@ class Session(object):
if self.logged == True:
raise Exceptions.AlreadyAuthorisedError("The authorisation process is not needed at this time.")
else:
self.authorisation_thread = call_threaded(self.twitter.authorise, self.settings)
self.twitter.authorise()
self.authorisation_dialog = authorisationDialog()
self.authorisation_dialog.cancel.Bind(wx.EVT_BUTTON, self.authorisation_cancelled)
pub.subscribe(self.authorisation_accepted, "authorisation-accepted")
self.authorisation_dialog.ok.Bind(wx.EVT_BUTTON, self.authorisation_accepted)
self.authorisation_dialog.ShowModal()
def authorisation_cancelled(self, *args, **kwargs):
pub.sendMessage("authorisation-cancelled")
self.authorisation_dialog.Destroy()
del self.authorisation_dialog
def authorisation_accepted(self):
pub.unsubscribe(self.authorisation_accepted, "authorisation-accepted")
def authorisation_accepted(self, *args, **kwargs):
pincode = self.authorisation_dialog.text.GetValue()
self.twitter.verify_authorisation(self.settings, pincode)
self.authorisation_dialog.Destroy()
def get_more_items(self, update_function, users=False, name=None, *args, **kwargs):

View File

@@ -80,7 +80,9 @@ class authorisationDialog(wx.Dialog):
super(authorisationDialog, self).__init__(parent=None, title=_(u"Authorising account..."))
panel = wx.Panel(self)
sizer = wx.BoxSizer(wx.VERTICAL)
self.text = wx.TextCtrl(panel, -1, _("Waiting for account authorisation..."), style=wx.TE_READONLY|wx.TE_MULTILINE)
static = wx.StaticText(panel, wx.NewId(), _(u"Enter your PIN code here"))
self.text = wx.TextCtrl(panel, -1)
self.ok = wx.Button(panel, wx.ID_OK)
self.cancel = wx.Button(panel, wx.ID_CANCEL)
sizer.Add(self.text, 0, wx.ALL, 5)
sizer.Add(self.cancel, 0, wx.ALL, 5)