Skip to content

Commit

Permalink
Fixed session timeout bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Timothy E. Johansson committed Apr 26, 2014
1 parent 1877bae commit 53142b5
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 17 deletions.
36 changes: 20 additions & 16 deletions angularjs.userapp.js
Original file line number Diff line number Diff line change
Expand Up @@ -296,26 +296,30 @@ var userappModule = angular.module('UserApp', []);

// Load the logged in user
this.loadUser(function(error, result) {
callback && callback(error, result);
$rootScope.$broadcast('user.login');
if (!error) {
callback && callback(error, result);
$rootScope.$broadcast('user.login');

// Check permissions for this route
if ($state) {
if ($state.$current && $state.$current.data && $state.$current.data.hasPermission) {
if (!that.hasPermission($state.$current.data.hasPermission)) {
$timeout(function() {
transitionTo(defaultRoute, true);
});
// Check permissions for this route
if ($state) {
if ($state.$current && $state.$current.data && $state.$current.data.hasPermission) {
if (!that.hasPermission($state.$current.data.hasPermission)) {
$timeout(function() {
transitionTo(defaultRoute, true);
});
}
}
}
} else if ($route) {
if ($route.current && $route.current.$$route.hasPermission) {
if (!that.hasPermission($route.current.$$route.hasPermission)) {
$timeout(function() {
transitionTo(defaultRoute);
});
} else if ($route) {
if ($route.current && $route.current.$$route.hasPermission) {
if (!that.hasPermission($route.current.$$route.hasPermission)) {
$timeout(function() {
transitionTo(defaultRoute);
});
}
}
}
} else {
that.reset();
}
});
},
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "userapp-angular",
"version": "1.6.0",
"version": "1.6.1",
"main": "./angularjs.userapp.js",
"dependencies": {
"userapp": "latest"
Expand Down

0 comments on commit 53142b5

Please sign in to comment.