Show error when loading an account with invalid or expired tokens. Fixes #328

This commit is contained in:
2020-05-29 11:17:18 -05:00
parent ed5b66d033
commit 4fa983a314
3 changed files with 14 additions and 3 deletions

View File

@@ -21,7 +21,7 @@ from sessions.twitter import session
from . import manager
import config_utils
import config
from twython.exceptions import TwythonAuthError
log = logging.getLogger("sessionmanager.sessionManager")
class sessionManagerController(object):
@@ -85,11 +85,18 @@ class sessionManagerController(object):
s = session.Session(i)
s.get_configuration()
if i not in config.app["sessions"]["ignored_sessions"]:
s.login()
try:
s.login()
except TwythonAuthError:
self.show_auth_error(s.settings["twitter"]["user_name"])
continue
sessions.sessions[i] = s
self.new_sessions[i] = s
# self.view.destroy()
def show_auth_error(self, user_name):
error = view.auth_error(user_name)
def manage_new_account(self, *args, **kwargs):
if self.view.new_account_dialog() == widgetUtils.YES:
location = (str(time.time())[-6:])

View File

@@ -75,4 +75,7 @@ class sessionManagerWindow(wx.Dialog):
self.configuration.Hide()
def destroy(self):
self.Destroy()
self.Destroy()
def auth_error(user_name):
return wx.MessageDialog(None, _("TWBlue is unable to authenticate the account for {} in Twitter. It might be due to an invalid or expired token, revoqued access to the application, or after an account reactivation. Please remove the account manually from your Twitter sessions in order to stop seeing this message.").format(user_name,), _("Authentication error for session {}").format(user_name,), wx.OK).ShowModal()