Login redirect to originally requested URL

This commit is contained in:
Allyen
2015-05-04 11:49:07 +02:00
parent ab0e549c70
commit 2f4ff6aaae
2 changed files with 4 additions and 2 deletions

View File

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

View File

@@ -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 || "");
});
});