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); + } + });