1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-15 07:43:35 +00:00

replace jwthelper

This commit is contained in:
Kyle Spearrin
2016-09-03 00:11:57 -04:00
parent e322c77725
commit 4c29b61189
3 changed files with 63 additions and 8 deletions

View File

@@ -85,12 +85,12 @@
}
});
})
.run(function ($rootScope, userService, loginService, jwtHelper, tokenService, $state) {
.run(function ($rootScope, userService, loginService, tokenService, $state) {
$rootScope.$on('$stateChangeStart', function (event, toState, toParams) {
tokenService.getToken(function (token) {
userService.isAuthenticated(function (isAuthenticated) {
if (!toState.data || !toState.data.authorize) {
if (isAuthenticated && !jwtHelper.isTokenExpired(token)) {
if (isAuthenticated && !tokenService.isTokenExpired(token)) {
event.preventDefault();
$state.go('tabs.current');
}
@@ -98,7 +98,7 @@
return;
}
if (!isAuthenticated || jwtHelper.isTokenExpired(token)) {
if (!isAuthenticated || tokenService.isTokenExpired(token)) {
event.preventDefault();
loginService.logOut(function () {
$state.go('login');