Commit d2298bf07ba1c0d104b4ed722c6f15a0be7048a3
1 parent
c1aeaeea
Exists in
master
and in
2 other branches
Redirect to login screen if session expired
Showing
1 changed file
with
7 additions
and
3 deletions
Show diff stats
ConfJuvApp/www/js/controllers.js
@@ -20,7 +20,7 @@ angular.module('confjuvapp.controllers', []) | @@ -20,7 +20,7 @@ angular.module('confjuvapp.controllers', []) | ||
20 | 20 | ||
21 | // Function to open the modal | 21 | // Function to open the modal |
22 | $scope.openModal = function() { | 22 | $scope.openModal = function() { |
23 | - if(ConfJuvAppUtils.getPrivateToken()){ | 23 | + if (ConfJuvAppUtils.getPrivateToken()) { |
24 | $scope.token = ConfJuvAppUtils.getPrivateToken(); | 24 | $scope.token = ConfJuvAppUtils.getPrivateToken(); |
25 | $scope.loggedIn = true; | 25 | $scope.loggedIn = true; |
26 | $scope.loadMe(); | 26 | $scope.loadMe(); |
@@ -251,7 +251,7 @@ angular.module('confjuvapp.controllers', []) | @@ -251,7 +251,7 @@ angular.module('confjuvapp.controllers', []) | ||
251 | $scope.signupPersonFields = resp.data; | 251 | $scope.signupPersonFields = resp.data; |
252 | $scope.loading = false; | 252 | $scope.loading = false; |
253 | }, function(err) { | 253 | }, function(err) { |
254 | - $ionicPopup.alert({ title: 'Campos Customizados de Registro', template: 'Não foi possível carregar os campos customizados de cadastro' }); | 254 | + $ionicPopup.alert({ title: 'Campos de Registro', template: 'Não foi possível carregar os campos de registro.' }); |
255 | $scope.loading = false; | 255 | $scope.loading = false; |
256 | }); | 256 | }); |
257 | }; | 257 | }; |
@@ -268,7 +268,11 @@ angular.module('confjuvapp.controllers', []) | @@ -268,7 +268,11 @@ angular.module('confjuvapp.controllers', []) | ||
268 | $scope.user = resp.data.person; | 268 | $scope.user = resp.data.person; |
269 | $scope.loading = false; | 269 | $scope.loading = false; |
270 | }, function(err) { | 270 | }, function(err) { |
271 | - $ionicPopup.alert({ title: 'Usuário', template: 'Não foi possível carregar o usuário' }); | 271 | + $scope.token = ConfJuvAppUtils.setPrivateToken(null); |
272 | + var popup = $ionicPopup.alert({ title: 'Usuário', template: 'Sessão expirada. Por favor faça login novamente.' }); | ||
273 | + popup.then(function() { | ||
274 | + $scope.openModal(); | ||
275 | + }); | ||
272 | $scope.loading = false; | 276 | $scope.loading = false; |
273 | }); | 277 | }); |
274 | }; | 278 | }; |