Fixed two factor auth in socializer!

This commit is contained in:
Manuel Cortez 2019-05-05 01:01:31 -05:00
parent ca7b3eff29
commit fdcaf4e596
3 changed files with 4 additions and 14 deletions

View File

@ -6,6 +6,8 @@
### bugfixes
* Fixed an error with two factor authentication in the recent socializer version. Now it works reliably again.
### Changes
* the audio player module has received some improvements:

View File

@ -72,9 +72,7 @@ def get_non_refreshed(login, password, scope=scope):
client_id=client_id, client_secret=client_secret, username=login,
password=password, v=api_ver, scope=scope, device_id=device_id, code=code)
r = requests.get(url, params=params, headers=headers)
log.exception(r.json())
if r.status_code == 200 and 'access_token' in r.text:
log.exception(r.json())
res = r.json()
# Retrieve access_token and secret.
access_token = res['access_token']

View File

@ -4,24 +4,14 @@ import time
import wx
import widgetUtils
code = None
remember = True
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
code = None
dlg = wx.TextEntryDialog(None, _("Please provide the authentication code you have received from VK."), _("Two factor authentication code"))
response = dlg.ShowModal()
if response == widgetUtils.OK:
code = dlg.GetValue()
dlg.Destroy()
dlg.Destroy()
return (code, True)
def bad_password():
return wx.MessageDialog(None, _("Your password or email address are incorrect. Please fix the mistakes and try it again."), _("Wrong data"), wx.ICON_ERROR).ShowModal()