summaryrefslogtreecommitdiff
path: root/client/js/services/Identity.js
diff options
context:
space:
mode:
Diffstat (limited to 'client/js/services/Identity.js')
-rw-r--r--client/js/services/Identity.js56
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,