From 6a534ade9fb81be7724f0e17b51d5027faaa0174 Mon Sep 17 00:00:00 2001 From: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com> Date: Fri, 29 Jan 2021 10:04:34 -0800 Subject: [PATCH] Redirect internally after login instead of client side * Fixes Tautulli/Tautulli-Issues#300 --- data/interfaces/default/login.html | 2 +- plexpy/webauth.py | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/data/interfaces/default/login.html b/data/interfaces/default/login.html index f49ad8b4..06b1be0f 100644 --- a/data/interfaces/default/login.html +++ b/data/interfaces/default/login.html @@ -160,7 +160,7 @@ dataType: 'json', statusCode: { 200: function(xhr, status) { - window.location = "${redirect_uri or http_root}"; + window.location = "redirect?redirect_uri=${redirect_uri}"; }, 401: function(xhr, status) { if (plex) { diff --git a/plexpy/webauth.py b/plexpy/webauth.py index ca27755c..0b8cc510 100644 --- a/plexpy/webauth.py +++ b/plexpy/webauth.py @@ -419,3 +419,7 @@ class AuthController(object): logger.debug("Tautulli WebAuth :: Invalid Plex OAuth login attempt.") cherrypy.response.status = 401 return error_message + + @cherrypy.expose + def redirect(self, redirect_uri='', *args, **kwargs): + raise cherrypy.HTTPRedirect(plexpy.HTTP_ROOT + redirect_uri.strip('/'))