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();
|
||||
}
|
||||
else {
|
||||
$('#loginModal').modal('hide');
|
||||
Identity.profile.username=username;
|
||||
Identity.profile.projectname=projectname;
|
||||
|
||||
$('#loginModal').modal('hide');
|
||||
}
|
||||
|
||||
// Reset button state
|
||||
|
|
|
@ -1,11 +1,15 @@
|
|||
|
||||
mainApp.factory('Identity',[ '$http', function($http){
|
||||
|
||||
/* Create profile structure */
|
||||
var profile={};
|
||||
profile.username="None";
|
||||
profile.projectname="None";
|
||||
|
||||
profile.username="Undefined";
|
||||
profile.projectname="Undefined";
|
||||
profile.token="";
|
||||
|
||||
|
||||
/**
|
||||
* Function to connect to OpenStack
|
||||
*
|
||||
* @param {object} $http Angular $http service
|
||||
* @param {string} username The user name
|
||||
|
@ -14,6 +18,9 @@ mainApp.factory('Identity',[ '$http', function($http){
|
|||
* @returns {promise} The result of the request
|
||||
*/
|
||||
var login=function(username, password,projectname){
|
||||
profile.username=username;
|
||||
profile.projectname=projectname;
|
||||
|
||||
return $http.post('../server/index.php',
|
||||
$.param({"task" : "Authenticate", "user" : username, "password" : password, "project" : projectname}));
|
||||
};
|
||||
|
@ -29,7 +36,7 @@ mainApp.factory('Identity',[ '$http', function($http){
|
|||
|
||||
requestParserResult.status=0;
|
||||
requestParserResult.data=response.data;
|
||||
|
||||
profile.token="Un Token";
|
||||
|
||||
// TODO
|
||||
|
||||
|
@ -39,6 +46,7 @@ mainApp.factory('Identity',[ '$http', function($http){
|
|||
|
||||
|
||||
|
||||
// Return services objects
|
||||
return {
|
||||
login: login,
|
||||
parseLoginAnswer: parseLoginAnswer,
|
||||
|
|
Loading…
Add table
Reference in a new issue