summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authormanzerbredes <loic.guegan_secondary@yahoo.fr>2016-02-10 19:28:31 +0100
committermanzerbredes <loic.guegan_secondary@yahoo.fr>2016-02-10 19:28:31 +0100
commite026ce21b48eddc9c4ca03b441d03baff217d3ad (patch)
treed443ab68da70a766d34dcc3e9168c9a8ca67f38f /client
parent7b9f17ba036f016078aea27565e1d31fce586b3f (diff)
parent0c985435949c1b7cd034d70559f8bcce744418de (diff)
Merge branch 'loic' into develop
Diffstat (limited to 'client')
-rw-r--r--client/js/controllers/login.js4
-rw-r--r--client/js/services/Identity.js11
2 files changed, 11 insertions, 4 deletions
diff --git a/client/js/controllers/login.js b/client/js/controllers/login.js
index 106e889..60eb52f 100644
--- a/client/js/controllers/login.js
+++ b/client/js/controllers/login.js
@@ -29,10 +29,10 @@ mainApp.controller('loginCtrl', ['$scope','$sce','Identity', function ($scope,$s
result.then(function (response){
// Parser result
- var requestResultObject=Identity.parseLoginAnswer(response);
+ var response=Identity.getResponse();
// Check for error
- if(requestResultObject.status!==0){
+ if(response.status!==0){
$('#failedToLoginAlert').show();
}
diff --git a/client/js/services/Identity.js b/client/js/services/Identity.js
index 7021003..509f800 100644
--- a/client/js/services/Identity.js
+++ b/client/js/services/Identity.js
@@ -7,6 +7,8 @@ mainApp.factory('Identity',[ '$http', function($http){
profile.projectname="Undefined";
profile.token="";
+ /* Will contain the result of the $http request */
+ var $httpResponse;
/**
* Function to connect to OpenStack
@@ -21,8 +23,9 @@ mainApp.factory('Identity',[ '$http', function($http){
profile.username=username;
profile.projectname=projectname;
- return $http.post('../server/index.php',
+ $httpResponse=$http.post('../server/index.php',
$.param({"task" : "Authenticate", "user" : username, "password" : password, "project" : projectname}));
+ return $httpResponse;
};
@@ -45,11 +48,15 @@ mainApp.factory('Identity',[ '$http', function($http){
};
+ var getResponse=function(){
+ return parseLoginAnswer($httpResponse);
+ }
+
// Return services objects
return {
login: login,
- parseLoginAnswer: parseLoginAnswer,
+ getResponse: getResponse,
profile: profile
};