From 3ce5ff882e1b8a20149e3318a9a16ec8256be325 Mon Sep 17 00:00:00 2001 From: Shannon Date: Thu, 7 May 2015 09:11:25 +1000 Subject: [PATCH] Fixes U4-5213 in a better way using a query string so it's clear where it redirects to --- src/Umbraco.Web.UI.Client/src/init.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/init.js b/src/Umbraco.Web.UI.Client/src/init.js index d95c711e0e..cb79c8e402 100644 --- a/src/Umbraco.Web.UI.Client/src/init.js +++ b/src/Umbraco.Web.UI.Client/src/init.js @@ -46,10 +46,17 @@ app.run(['userService', '$log', '$rootScope', '$location', 'navigationService', $rootScope.$on('$routeChangeError', function(event, current, previous, rejection) { event.preventDefault(); - //Set the current path before redirecting so we know where to redirect back to - var returnPath = encodeURIComponent($location.url()); + var returnPath = null; + if (rejection.path == "/login" || rejection.path.startsWith("/login/")) { + //Set the current path before redirecting so we know where to redirect back to + returnPath = encodeURIComponent($location.url()); + } - $location.path(rejection.path).search("returnPath", returnPath); + $location.path(rejection.path) + if (returnPath) { + $location.search("returnPath", returnPath); + } + });