Roberto Sánchez
2014-01-22 1a0d1f15efa2b4cbdc6dd30b5a85b111d0599b63
securis/src/main/resources/static/js/main.js
....@@ -28,7 +28,21 @@
2828 return rejection.status === 401 /* Unauthorized */;
2929 }
3030 return {
31
-
31
+ 'request': function(config) {
32
+ var la = $store.get('last_access');
33
+ var now = new Date().getTime();
34
+ if (la !== null) {
35
+ if (now > (la + 1800000)) { // Session timeout is 1/2 hour
36
+ $store.clear();
37
+ $location.path('/login');
38
+ BootstrapDialog.alert('Session has expired');
39
+ } else {
40
+ console.log('Last access recent');
41
+ }
42
+ }
43
+ $store.set('last_access', now);
44
+ return config || $q.when(config);
45
+ },
3246 'responseError': function(rejection) {
3347 // do something on error
3448 if (isUnauthorizedAccess(rejection)) {