diff --git a/src/Umbraco.Web.UI.Client/src/init.js b/src/Umbraco.Web.UI.Client/src/init.js index f31e81e5d3..eb1bdfe2e8 100644 --- a/src/Umbraco.Web.UI.Client/src/init.js +++ b/src/Umbraco.Web.UI.Client/src/init.js @@ -44,6 +44,8 @@ app.run(['userService', '$log', '$rootScope', '$location', 'navigationService', wiring up it's controller, etc... and then redirect to the rejected URL. */ $rootScope.$on('$routeChangeError', function(event, current, previous, rejection) { event.preventDefault(); + $rootScope.returnToPath = $location.$$path; + $rootScope.returnToSearch = $location.$$search; $location.path(rejection.path).search(rejection.search); }); diff --git a/src/Umbraco.Web.UI.Client/src/views/common/login.controller.js b/src/Umbraco.Web.UI.Client/src/views/common/login.controller.js index ad8fec63a9..59d8f6bf57 100644 --- a/src/Umbraco.Web.UI.Client/src/views/common/login.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/common/login.controller.js @@ -1,10 +1,10 @@ /** This controller is simply here to launch the login dialog when the route is explicitly changed to /login */ -angular.module('umbraco').controller("Umbraco.LoginController", function (eventsService, $scope, userService, $location) { +angular.module('umbraco').controller("Umbraco.LoginController", function (eventsService, $scope, userService, $location, $rootScope) { userService._showLoginDialog(); eventsService.on("app.ready", function(){ $scope.avatar = "assets/img/application/logo.png"; - $location.path("/").search(""); + $location.path($rootScope.returnToPath || "/").search($rootScope.returnToSearch || ""); }); }); \ No newline at end of file