Skip to content

Commit 02a8549

Browse files
committed
Make verify state return new target if redirect required
1 parent d9fe9fa commit 02a8549

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/angularJwt/services/authManager.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ angular.module('angular-jwt.authManager', [])
4949
$rootScope.$broadcast('tokenHasExpired', token);
5050
}
5151
}
52-
}
52+
}
5353

5454
function checkAuthOnRefresh() {
5555
if ($injector.has('$transitions')) {
@@ -82,9 +82,9 @@ angular.module('angular-jwt.authManager', [])
8282

8383
function verifyState(transition) {
8484
var route = transition.to();
85+
var $state = transition.router.stateService;
8586
if (route && route.data && route.data.requiresLogin === true && !isAuthenticated()) {
86-
invokeRedirector(config.unauthenticatedRedirector);
87-
return false;
87+
return $state.target(config.loginPath);
8888
}
8989
}
9090

0 commit comments

Comments
 (0)