Add autologin config option and cli parameter
This commit is contained in:
@@ -205,7 +205,7 @@ def main():
|
||||
|
||||
# Authorize on launch if the refresh token is present
|
||||
oauth = OAuthHelper(reddit, term, config)
|
||||
if config.refresh_token:
|
||||
if config['autologin'] and config.refresh_token:
|
||||
oauth.authorize()
|
||||
|
||||
page = None
|
||||
|
||||
@@ -64,6 +64,9 @@ def build_parser():
|
||||
parser.add_argument(
|
||||
'--non-persistent', dest='persistent', action='store_const', const=False,
|
||||
help='Forget the authenticated user when the program exits')
|
||||
parser.add_argument(
|
||||
'--no-autologin', dest='autologin', action='store_const', const=False,
|
||||
help='Do not authenticate automatically on startup')
|
||||
parser.add_argument(
|
||||
'--clear-auth', dest='clear_auth', action='store_const', const=True,
|
||||
help='Remove any saved user data before launching')
|
||||
@@ -259,6 +262,7 @@ class Config(object):
|
||||
'ascii': partial(config.getboolean, 'rtv'),
|
||||
'monochrome': partial(config.getboolean, 'rtv'),
|
||||
'persistent': partial(config.getboolean, 'rtv'),
|
||||
'autologin': partial(config.getboolean, 'rtv'),
|
||||
'clear_auth': partial(config.getboolean, 'rtv'),
|
||||
'enable_media': partial(config.getboolean, 'rtv'),
|
||||
'history_size': partial(config.getint, 'rtv'),
|
||||
|
||||
@@ -31,6 +31,9 @@ subreddit = front
|
||||
; Allow rtv to store reddit authentication credentials between sessions.
|
||||
persistent = True
|
||||
|
||||
; Automatically log in on startup, if credentials are available.
|
||||
autologin = True
|
||||
|
||||
; Clear any stored credentials when the program starts.
|
||||
clear_auth = False
|
||||
|
||||
|
||||
Reference in New Issue
Block a user