From 1a0d1f15efa2b4cbdc6dd30b5a85b111d0599b63 Mon Sep 17 00:00:00 2001
From: Roberto Sánchez <roberto.sanchez@curisit.net>
Date: Wed, 22 Jan 2014 20:59:13 +0000
Subject: [PATCH] #396 feature - Added session timeout and responsive layour untill 1600px

---
 securis/src/main/resources/static/js/main.js |   16 +++++++++++++++-
 1 files changed, 15 insertions(+), 1 deletions(-)

diff --git a/securis/src/main/resources/static/js/main.js b/securis/src/main/resources/static/js/main.js
index 9a13354..957e197 100644
--- a/securis/src/main/resources/static/js/main.js
+++ b/securis/src/main/resources/static/js/main.js
@@ -28,7 +28,21 @@
 			return rejection.status === 401 /* Unauthorized */;
 		} 
 		  return {
-
+		      'request': function(config) {
+		          var la = $store.get('last_access');
+		          var now = new Date().getTime();
+		          if (la !== null) {
+		              if (now > (la + 1800000)) { // Session timeout is 1/2 hour
+                          $store.clear();
+                          $location.path('/login');
+                          BootstrapDialog.alert('Session has expired');
+		              } else {
+		                  console.log('Last access recent');
+		              }
+		          }
+		          $store.set('last_access', now);
+		          return config || $q.when(config);
+		      },
 		   'responseError': function(rejection) {
 		      // do something on error
 		      if (isUnauthorizedAccess(rejection)) {

--
Gitblit v1.3.2