Add login check witouth reloading page

This commit is contained in:
manzerbredes 2016-03-21 06:47:01 +01:00
parent 3216a69b75
commit 3c336f00d2
284 changed files with 141 additions and 31 deletions

View file

@ -1,5 +1,5 @@
mainApp.factory('Identity',[ '$http', '$cookies', function($http, $cookies){
mainApp.factory('Identity',[ '$http', '$cookies', '$rootScope', function($http, $cookies, $rootScope){
/* Create profile structure to store informations
* about current session
@ -27,17 +27,20 @@ mainApp.factory('Identity',[ '$http', '$cookies', function($http, $cookies){
&& typeof tokenPart_1InCookie !== 'undefined'
){
if(token!==null){
//if(token!==null){
// If yes, put it into variables
angular.extend(profile, profileInCookie);
token=tokenPart_0InCookie+tokenPart_1InCookie;
}
//}
// Return I'm Login
return true;
}
// Show the login overlay
$rootScope.$broadcast("logoutEvent");
// Return I'm not Login
return false;
}
@ -56,7 +59,9 @@ mainApp.factory('Identity',[ '$http', '$cookies', function($http, $cookies){
profile.projectname=null;
// Reload Page
location.reload();
//location.reload();
$rootScope.$broadcast("logoutEvent");
}