Added welcome message when logging in for the first time with autologin disabled

This commit is contained in:
Michael Lazar
2018-10-01 01:45:33 -04:00
parent 7a1f2ea2eb
commit 19f246adac
5 changed files with 156 additions and 15 deletions

View File

@@ -137,7 +137,7 @@ class OAuthHelper(object):
if '.compact' not in self.reddit.config.API_PATHS['authorize']:
self.reddit.config.API_PATHS['authorize'] += '.compact'
def authorize(self):
def authorize(self, autologin=False):
self.params.update(state=None, code=None, error=None)
@@ -163,6 +163,14 @@ class OAuthHelper(object):
raise InvalidRefreshToken(
' Invalid user credentials!\n'
'The cached refresh token has been removed')
else:
if not autologin:
# Only show the welcome message if explicitly logging
# in, not when RTV first launches.
message = 'Welcome {}!'.format(self.reddit.user.name)
self.term.show_notification(message)
return
state = uuid.uuid4().hex