Merge branch 'loic' into develop
This commit is contained in:
commit
e026ce21b4
2 changed files with 11 additions and 4 deletions
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue