# HG changeset patch # User rougeronj # Date 1434710704 -7200 # Node ID a8231241f50d6dd7b5b1a7434734bd625a86c33e # Parent d7e1920ec9ae9acf21440a8bb4d80666f4abd87d try to get first the context.token set up by the server. If it doesn't exist, try to get back the token in the local storage. Or get to the login page. diff -r d7e1920ec9ae -r a8231241f50d client/app/app.js --- a/client/app/app.js Thu Jun 11 16:23:47 2015 +0200 +++ b/client/app/app.js Fri Jun 19 12:45:04 2015 +0200 @@ -76,10 +76,10 @@ }) .run( function($rootScope, $location, $window, $http, authApi, context) { $rootScope.globals = {}; - if (localStorage.getItem('token') || context.token) { + if (context.token || localStorage.getItem('token')) { $rootScope.globals.userLogged = true; - localStorage.setItem('token', (localStorage.getItem('token') || context.token)); - $http.defaults.headers.common.Authorization = 'Token ' + (localStorage.getItem('token') || context.token); + localStorage.setItem('token', (context.token || localStorage.getItem('token') )); + $http.defaults.headers.common.Authorization = 'Token ' + (context.tokenĀ || localStorage.getItem('token')); } $rootScope.$on( '$routeChangeStart', function(event, next) { if (next.authRequired && !$rootScope.globals.userLogged) {