diff --git a/changelog.md b/changelog.md index 4b4935f..eef06e2 100644 --- a/changelog.md +++ b/changelog.md @@ -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: diff --git a/src/authenticator/official.py b/src/authenticator/official.py index c459302..24c3cfd 100644 --- a/src/authenticator/official.py +++ b/src/authenticator/official.py @@ -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'] diff --git a/src/authenticator/wxUI.py b/src/authenticator/wxUI.py index 77563c3..348d9b6 100644 --- a/src/authenticator/wxUI.py +++ b/src/authenticator/wxUI.py @@ -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() \ No newline at end of file