summaryrefslogtreecommitdiff
path: root/client/js
diff options
context:
space:
mode:
Diffstat (limited to 'client/js')
-rw-r--r--client/js/controllers/login.js5
-rw-r--r--client/js/services/Identity.js16
2 files changed, 13 insertions, 8 deletions
diff --git a/client/js/controllers/login.js b/client/js/controllers/login.js
index e9308b8..106e889 100644
--- a/client/js/controllers/login.js
+++ b/client/js/controllers/login.js
@@ -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
diff --git a/client/js/services/Identity.js b/client/js/services/Identity.js
index 2164592..7021003 100644
--- a/client/js/services/Identity.js
+++ b/client/js/services/Identity.js
@@ -1,11 +1,15 @@
mainApp.factory('Identity',[ '$http', function($http){
- var profile={};
- profile.username="None";
- profile.projectname="None";
+ /* Create profile structure */
+ var profile={};
+ 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,