diff options
| author | manzerbredes <loic.guegan_secondary@yahoo.fr> | 2016-02-22 17:14:11 +0100 |
|---|---|---|
| committer | manzerbredes <loic.guegan_secondary@yahoo.fr> | 2016-02-22 17:14:11 +0100 |
| commit | 0c31cbdbd4aaf41c5f24f96e1ee0ae79a8baee24 (patch) | |
| tree | 85b91c2e26c20e36b16fd5876434116c026e95b9 | |
| parent | d3047bb539a2256cf357784ff49e0ad58e638500 (diff) | |
Comment and update things
| -rw-r--r-- | client/js/services/Identity.js | 56 |
1 files changed, 12 insertions, 44 deletions
diff --git a/client/js/services/Identity.js b/client/js/services/Identity.js index d96b3ab..8ee664c 100644 --- a/client/js/services/Identity.js +++ b/client/js/services/Identity.js @@ -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, |
