diff options
| author | manzerbredes <loic.guegan_secondary@yahoo.fr> | 2016-02-10 17:47:01 +0100 |
|---|---|---|
| committer | manzerbredes <loic.guegan_secondary@yahoo.fr> | 2016-02-10 17:47:01 +0100 |
| commit | 65bcc720596b395298fa281b5b68737d04ffdb8a (patch) | |
| tree | d0d9d890d3562bf806665845e2c1989bc25e1492 /client/js/services/Identity.js | |
| parent | 1cd1ae92f414573942262f65dc1644e8ff9bb8f6 (diff) | |
Make Identity module more AngularJs Like !
Diffstat (limited to 'client/js/services/Identity.js')
| -rw-r--r-- | client/js/services/Identity.js | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/client/js/services/Identity.js b/client/js/services/Identity.js new file mode 100644 index 0000000..2164592 --- /dev/null +++ b/client/js/services/Identity.js @@ -0,0 +1,49 @@ + +mainApp.factory('Identity',[ '$http', function($http){ + var profile={}; + profile.username="None"; + profile.projectname="None"; + + + /** + * + * @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 + */ + var login=function(username, password,projectname){ + return $http.post('../server/index.php', + $.param({"task" : "Authenticate", "user" : username, "password" : password, "project" : projectname})); + }; + + + /** + * + * @param {string} response The response to parse + * @returns {requestParserResult} Formated data + */ + var parseLoginAnswer=function(response){ + var requestParserResult={}; + + requestParserResult.status=0; + requestParserResult.data=response.data; + + + // TODO + + + return requestParserResult; + }; + + + + return { + login: login, + parseLoginAnswer: parseLoginAnswer, + profile: profile + }; + + +}]); |
