Clean Identity service
This commit is contained in:
parent
d74a6b510c
commit
f1628e280a
1 changed files with 12 additions and 1 deletions
|
@ -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";
|
||||
|
@ -120,6 +127,9 @@ mainApp.factory('Identity',[ '$http', '$cookies', function($http, $cookies){
|
|||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Get the profile
|
||||
*/
|
||||
|
@ -135,6 +145,7 @@ mainApp.factory('Identity',[ '$http', '$cookies', function($http, $cookies){
|
|||
}
|
||||
|
||||
|
||||
|
||||
// Return services objects
|
||||
return {
|
||||
login: login,
|
||||
|
|
Loading…
Add table
Reference in a new issue