Comment and update things
This commit is contained in:
parent
d3047bb539
commit
0c31cbdbd4
1 changed files with 12 additions and 44 deletions
|
@ -9,56 +9,18 @@ mainApp.factory('Identity',[ '$http', '$cookies', function($http, $cookies){
|
|||
profile.projectname=null;
|
||||
profile.token=null;
|
||||
|
||||
/* var tokenFragment=9;
|
||||
|
||||
var saveTokenInCookies=function(){
|
||||
var i=0;
|
||||
var currentStart=0;
|
||||
var currentEnd=parseInt(profile.token.length/tokenFragment);
|
||||
var facto=currentEnd;
|
||||
|
||||
alert("current ren" + currentEnd);
|
||||
for(i=0;i<tokenFragment-1;i++){
|
||||
|
||||
$cookies.put("token-"+i, profile.token.substring(currentStart, currentEnd));
|
||||
|
||||
|
||||
currentStart=currentEnd+1;
|
||||
currentEnd=currentEnd+facto;
|
||||
|
||||
|
||||
}
|
||||
|
||||
$cookies.put("token-"+(i+1), profile.token.substring(currentEnd, profile.token.length));
|
||||
};
|
||||
|
||||
var loadTokenInCookies=function(){
|
||||
var i=0;
|
||||
|
||||
profile.token=$cookies.get("token-0");
|
||||
for(i=1;i<tokenFragment;i++){
|
||||
|
||||
profile.token=profile.token+$cookies.get("token-"+i)
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
};*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Save profile in cookies
|
||||
*/
|
||||
var saveCookieForSession=function(){
|
||||
$cookies.putObject('profile', 5);
|
||||
//saveTokenInCookies();
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* @returns {boolean} Return true if a cookie is found (and load it in profile) false else
|
||||
*/
|
||||
var isAlreadyLogin=function(){
|
||||
var profileInCookie=$cookies.getObject('profile');
|
||||
console.log(profileInCookie);
|
||||
|
@ -71,9 +33,13 @@ mainApp.factory('Identity',[ '$http', '$cookies', function($http, $cookies){
|
|||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* Destroy profile cookies
|
||||
*/
|
||||
var logout=function(){
|
||||
$cookies.remove('profile');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -131,6 +97,8 @@ mainApp.factory('Identity',[ '$http', '$cookies', function($http, $cookies){
|
|||
});
|
||||
};
|
||||
|
||||
|
||||
|
||||
// Return services objects
|
||||
return {
|
||||
login: login,
|
||||
|
|
Loading…
Add table
Reference in a new issue