Login redirect to originally requested URL
This commit is contained in:
@@ -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);
|
||||
});
|
||||
|
||||
|
||||
@@ -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 || "");
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user