Check session enabled instead of auth

This commit is contained in:
JonnyWong16 2016-04-27 00:17:50 -07:00
parent 3ecc90d21a
commit 4679121115
2 changed files with 18 additions and 14 deletions

View file

@ -24,7 +24,7 @@ def get_session_info():
"""
from plexpy.webauth import SESSION_KEY
if cherrypy.config.get('tools.auth.on'):
if cherrypy.config.get('tools.sessions.on'):
_session = cherrypy.session.get(SESSION_KEY)
if _session:
return _session

View file

@ -66,10 +66,11 @@ def initialize(options):
if options['http_password']:
logger.info("Web server authentication is enabled, username is '%s'", options['http_username'])
options_dict['tools.auth.on'] = True
auth_enabled = True
options_dict['tools.sessions.on'] = True
options_dict['tools.sessions.timeout'] = 30 * 24 * 60 # 30 days
cherrypy.tools.auth = cherrypy.Tool('before_handler', webauth.check_auth)
else:
auth_enabled = False
if not options['http_root'] or options['http_root'] == '/':
plexpy.HTTP_ROOT = options['http_root'] = '/'
@ -85,7 +86,10 @@ def initialize(options):
'tools.gzip.on': True,
'tools.gzip.mime_types': ['text/html', 'text/plain', 'text/css',
'text/javascript', 'application/json',
'application/javascript']
'application/javascript'],
'tools.auth.on': auth_enabled,
'tools.sessions.on': True,
'tools.sessions.timeout': 30 * 24 * 60 # 30 days
},
'/interfaces': {
'tools.staticdir.on': True,