2016-01-31 11:47:13 +01:00
|
|
|
|
2016-02-06 12:10:04 +01:00
|
|
|
/**
|
|
|
|
* Client Identity Module
|
|
|
|
* @namespace identity
|
|
|
|
*/
|
2016-02-04 13:20:45 +01:00
|
|
|
var identity = {};
|
2016-02-03 12:30:12 +01:00
|
|
|
|
2016-02-06 12:10:04 +01:00
|
|
|
/**
|
|
|
|
* Contain all request who can be send with http request
|
|
|
|
* @namespace request
|
|
|
|
*/
|
|
|
|
identity.request = {};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Contain parser for result of request made by {@link identity.request}
|
|
|
|
* @namespace request
|
|
|
|
*/
|
|
|
|
identity.requestParser = {};
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @param {object} $http Angular $http service
|
|
|
|
* @param {string} username The user name
|
|
|
|
* @param {string} password The user password
|
|
|
|
* @param {string} projectname The user project name
|
|
|
|
* @returns {promise} The result of the request
|
|
|
|
*/
|
|
|
|
identity.request.login=function($http,username, password,projectname){
|
2016-02-05 20:52:13 +01:00
|
|
|
return $http.post('../server/index.php',
|
2016-02-07 11:10:44 +01:00
|
|
|
$.param({"task" : "Authenticate", "user" : username, "password" : password, "project" : projectname}));
|
2016-02-04 13:20:45 +01:00
|
|
|
};
|
2016-02-03 12:30:12 +01:00
|
|
|
|
2016-01-31 11:47:13 +01:00
|
|
|
|
2016-02-06 12:10:04 +01:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @param {string} response The response to parse
|
|
|
|
* @returns {requestParserResult} Formated data
|
|
|
|
*/
|
2016-02-05 17:47:53 +01:00
|
|
|
identity.requestParser.parseLoginAnswer=function(response){
|
|
|
|
var requestParserResult={};
|
|
|
|
|
|
|
|
requestParserResult.status=0;
|
|
|
|
requestParserResult.data=response.data;
|
2016-02-03 12:05:04 +01:00
|
|
|
|
2016-01-31 11:47:13 +01:00
|
|
|
|
2016-02-05 17:47:53 +01:00
|
|
|
// TODO
|
|
|
|
|
|
|
|
|
|
|
|
return requestParserResult;
|
|
|
|
};
|
2016-01-31 11:47:13 +01:00
|
|
|
|