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 ### bugfixes
* Fixed an error with two factor authentication in the recent socializer version. Now it works reliably again.
### Changes ### Changes
* the audio player module has received some improvements: * 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, client_id=client_id, client_secret=client_secret, username=login,
password=password, v=api_ver, scope=scope, device_id=device_id, code=code) password=password, v=api_ver, scope=scope, device_id=device_id, code=code)
r = requests.get(url, params=params, headers=headers) r = requests.get(url, params=params, headers=headers)
log.exception(r.json())
if r.status_code == 200 and 'access_token' in r.text: if r.status_code == 200 and 'access_token' in r.text:
log.exception(r.json())
res = r.json() res = r.json()
# Retrieve access_token and secret. # Retrieve access_token and secret.
access_token = res['access_token'] access_token = res['access_token']

View File

@ -4,24 +4,14 @@ import time
import wx import wx
import widgetUtils import widgetUtils
code = None
remember = True
def two_factor_auth(): def two_factor_auth():
global code, remember code = None
wx.CallAfter(get_code)
while code == None:
time.sleep(0.5)
return (code, remember)
def get_code():
global code, remember
dlg = wx.TextEntryDialog(None, _("Please provide the authentication code you have received from VK."), _("Two factor authentication code")) dlg = wx.TextEntryDialog(None, _("Please provide the authentication code you have received from VK."), _("Two factor authentication code"))
response = dlg.ShowModal() response = dlg.ShowModal()
if response == widgetUtils.OK: if response == widgetUtils.OK:
code = dlg.GetValue() code = dlg.GetValue()
dlg.Destroy()
dlg.Destroy() dlg.Destroy()
return (code, True)
def bad_password(): 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() 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()