Attempt to add two factor auth to socializer. Needs testing

This commit is contained in:
Manuel Cortez 2018-12-19 17:34:51 -06:00
parent 909fd9d68c
commit 48e3e39514
2 changed files with 16 additions and 0 deletions

View File

@ -42,6 +42,9 @@ class sessionManagerController(object):
if not os.path.exists(path):
os.mkdir(path)
s.get_configuration()
if view.two_factor_question() == widgetUtils.YES:
s.settings["vk"]["use_alternative_tokens"] = True
s.settings.write()
self.get_authorisation(s)
session.sessions[location] = s
else:

View File

@ -5,6 +5,19 @@ import widgetUtils
def new_account_dialog():
return wx.MessageDialog(None, _(u"In order to continue, you need to configure your VK account before. Would you like to autorhise a new account now?"), _(u"Authorisation"), wx.YES_NO).ShowModal()
def two_factor_auth():
dlg = wx.TextEntryDialog(None, _(u"Please provide the authentication code you have received from VK."), _(u"Two factor authentication code"))
response = dlg.ShowModal()
if response == widgetUtils.OK:
result = dlg.GetValue()
dlg.Destroy()
return (result, True)
dlg.Destroy()
def two_factor_question():
return wx.MessageDialog(None, _(u"Do you have two factor authentication enabled in your account?"), _(u"Authentication method"), wx.YES_NO).ShowModal()
class newSessionDialog(widgetUtils.BaseDialog):
def __init__(self):
super(newSessionDialog, self).__init__(parent=None, id=wx.NewId(), title=_(u"Authorise VK"))