Implemented two factor authentication for alternative tokens
This commit is contained in:
parent
17c6b7d282
commit
527d4670d4
@ -1,23 +1,34 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import time
|
||||
import wx
|
||||
import widgetUtils
|
||||
|
||||
code = None
|
||||
remember = True
|
||||
|
||||
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():
|
||||
global code, remember
|
||||
wx.CallAfter(get_code)
|
||||
while code == None:
|
||||
time.sleep(0.5)
|
||||
return (code, remember)
|
||||
|
||||
def get_code():
|
||||
global code, remember
|
||||
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()
|
||||
code = 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"))
|
||||
|
Loading…
Reference in New Issue
Block a user