Roberto Sánchez
2014-01-17 441c660af706fd3c6d0e06b36b8f25a808fcdf5f
securis/src/main/resources/static/js/main.js
....@@ -67,11 +67,20 @@
6767 m.controller('MainCtrl', ['$scope', '$http', '$location', '$L', '$store',
6868 function($scope, $http, $location, $L, $store) {
6969
70
+ $location.path('/login');
7071 if ($store.get('token') != null) {
71
- $http.defaults.headers.common['X-SECURIS-TOKEN'] = $store.get('token');
72
- $location.path('/licenses');
73
- } else {
74
- $location.path('/login');
72
+
73
+ $http.get('/check', {
74
+ headers: {
75
+ 'X-SECURIS-TOKEN': $store.get('token')
76
+ }
77
+ }).success(function(data) {
78
+ if (data.valid) {
79
+ $http.defaults.headers.common['X-SECURIS-TOKEN'] = $store.get('token');
80
+ $location.path('/licenses');
81
+ $store.set('user', data.user);
82
+ }
83
+ });
7584 }
7685
7786 $scope.logout = function() {