Optimize Identity
This commit is contained in:
parent
65bcc72059
commit
bfac821147
2 changed files with 13 additions and 8 deletions
|
@ -37,10 +37,7 @@ mainApp.controller('loginCtrl', ['$scope','$sce','Identity', function ($scope,$s
|
||||||
$('#failedToLoginAlert').show();
|
$('#failedToLoginAlert').show();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$('#loginModal').modal('hide');
|
$('#loginModal').modal('hide');
|
||||||
Identity.profile.username=username;
|
|
||||||
Identity.profile.projectname=projectname;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reset button state
|
// Reset button state
|
||||||
|
|
|
@ -1,11 +1,15 @@
|
||||||
|
|
||||||
mainApp.factory('Identity',[ '$http', function($http){
|
mainApp.factory('Identity',[ '$http', function($http){
|
||||||
|
|
||||||
|
/* Create profile structure */
|
||||||
var profile={};
|
var profile={};
|
||||||
profile.username="None";
|
profile.username="Undefined";
|
||||||
profile.projectname="None";
|
profile.projectname="Undefined";
|
||||||
|
profile.token="";
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Function to connect to OpenStack
|
||||||
*
|
*
|
||||||
* @param {object} $http Angular $http service
|
* @param {object} $http Angular $http service
|
||||||
* @param {string} username The user name
|
* @param {string} username The user name
|
||||||
|
@ -14,6 +18,9 @@ mainApp.factory('Identity',[ '$http', function($http){
|
||||||
* @returns {promise} The result of the request
|
* @returns {promise} The result of the request
|
||||||
*/
|
*/
|
||||||
var login=function(username, password,projectname){
|
var login=function(username, password,projectname){
|
||||||
|
profile.username=username;
|
||||||
|
profile.projectname=projectname;
|
||||||
|
|
||||||
return $http.post('../server/index.php',
|
return $http.post('../server/index.php',
|
||||||
$.param({"task" : "Authenticate", "user" : username, "password" : password, "project" : projectname}));
|
$.param({"task" : "Authenticate", "user" : username, "password" : password, "project" : projectname}));
|
||||||
};
|
};
|
||||||
|
@ -29,7 +36,7 @@ mainApp.factory('Identity',[ '$http', function($http){
|
||||||
|
|
||||||
requestParserResult.status=0;
|
requestParserResult.status=0;
|
||||||
requestParserResult.data=response.data;
|
requestParserResult.data=response.data;
|
||||||
|
profile.token="Un Token";
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
|
|
||||||
|
@ -39,6 +46,7 @@ mainApp.factory('Identity',[ '$http', function($http){
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Return services objects
|
||||||
return {
|
return {
|
||||||
login: login,
|
login: login,
|
||||||
parseLoginAnswer: parseLoginAnswer,
|
parseLoginAnswer: parseLoginAnswer,
|
||||||
|
|
Loading…
Add table
Reference in a new issue