diff --git a/src/sessionmanager/sessionManager.py b/src/sessionmanager/sessionManager.py index f2765f7..9e1b550 100644 --- a/src/sessionmanager/sessionManager.py +++ b/src/sessionmanager/sessionManager.py @@ -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: diff --git a/src/sessionmanager/wxUI.py b/src/sessionmanager/wxUI.py index bc5c088..1da7330 100644 --- a/src/sessionmanager/wxUI.py +++ b/src/sessionmanager/wxUI.py @@ -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"))