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.js13
1 files changed, 12 insertions, 1 deletions
diff --git a/client/js/services/Identity.js b/client/js/services/Identity.js
index b1d2a48..da85ecd 100644
--- a/client/js/services/Identity.js
+++ b/client/js/services/Identity.js
@@ -48,6 +48,9 @@ mainApp.factory('Identity',[ '$http', '$cookies', function($http, $cookies){
$cookies.remove('profile');
$cookies.remove('token.part_0');
$cookies.remove('token.part_1');
+ token=null;
+ profile.username=null;
+ profile.projectname=null;
}
@@ -81,6 +84,10 @@ mainApp.factory('Identity',[ '$http', '$cookies', function($http, $cookies){
$cookies.putObject('token.part_0', response.data.token.substring(0, middle), {'expires': expireDate});
// Save second part of token
$cookies.putObject('token.part_1', response.data.token.substring(middle, response.data.token.length), {'expires': expireDate});
+
+ // Put token in var
+ token=response.data.token;
+
}
else if(failedToSendRequest){
requestParserResult.failReason="Failed to send request";
@@ -102,7 +109,7 @@ mainApp.factory('Identity',[ '$http', '$cookies', function($http, $cookies){
* @param {string} projectname The user project name
* @param {function} function to call when data is avalaible
*/
- var login=function(username, password,projectname, callback){
+ var login=function(username, password,projectname,callback){
// Set profile information (early)
profile.username=username;
@@ -120,6 +127,9 @@ mainApp.factory('Identity',[ '$http', '$cookies', function($http, $cookies){
};
+
+
+
/*
* Get the profile
*/
@@ -133,6 +143,7 @@ mainApp.factory('Identity',[ '$http', '$cookies', function($http, $cookies){
var getToken=function(){
return token;
}
+
// Return services objects