mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-08-19 04:49:36 -07:00
Check if sessions enabled for login/logout
* Redirect to logout on session expiry to remove the session
This commit is contained in:
parent
5689dfd3e3
commit
85a7819469
1 changed files with 3 additions and 3 deletions
|
@ -61,7 +61,7 @@ def check_auth(*args, **kwargs):
|
||||||
if not condition():
|
if not condition():
|
||||||
raise cherrypy.HTTPRedirect(plexpy.HTTP_ROOT)
|
raise cherrypy.HTTPRedirect(plexpy.HTTP_ROOT)
|
||||||
else:
|
else:
|
||||||
raise cherrypy.HTTPRedirect("auth/login")
|
raise cherrypy.HTTPRedirect("auth/logout")
|
||||||
|
|
||||||
def requireAuth(*conditions):
|
def requireAuth(*conditions):
|
||||||
"""A decorator that appends conditions to the auth.require config
|
"""A decorator that appends conditions to the auth.require config
|
||||||
|
@ -137,7 +137,7 @@ class AuthController(object):
|
||||||
|
|
||||||
@cherrypy.expose
|
@cherrypy.expose
|
||||||
def login(self, username=None, password=None, remember_me='0'):
|
def login(self, username=None, password=None, remember_me='0'):
|
||||||
if not plexpy.CONFIG.HTTP_PASSWORD:
|
if not cherrypy.config.get('tools.sessions.on'):
|
||||||
raise cherrypy.HTTPRedirect(plexpy.HTTP_ROOT)
|
raise cherrypy.HTTPRedirect(plexpy.HTTP_ROOT)
|
||||||
|
|
||||||
if username is None or password is None:
|
if username is None or password is None:
|
||||||
|
@ -181,7 +181,7 @@ class AuthController(object):
|
||||||
|
|
||||||
@cherrypy.expose
|
@cherrypy.expose
|
||||||
def logout(self):
|
def logout(self):
|
||||||
if not plexpy.CONFIG.HTTP_PASSWORD:
|
if not cherrypy.config.get('tools.sessions.on'):
|
||||||
raise cherrypy.HTTPRedirect(plexpy.HTTP_ROOT)
|
raise cherrypy.HTTPRedirect(plexpy.HTTP_ROOT)
|
||||||
|
|
||||||
_session = cherrypy.session.get(SESSION_KEY)
|
_session = cherrypy.session.get(SESSION_KEY)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue