summaryrefslogtreecommitdiff
path: root/client/js/controllers
diff options
context:
space:
mode:
authormanzerbredes <loic.guegan_secondary@yahoo.fr>2016-02-10 17:47:01 +0100
committermanzerbredes <loic.guegan_secondary@yahoo.fr>2016-02-10 17:47:01 +0100
commit65bcc720596b395298fa281b5b68737d04ffdb8a (patch)
treed0d9d890d3562bf806665845e2c1989bc25e1492 /client/js/controllers
parent1cd1ae92f414573942262f65dc1644e8ff9bb8f6 (diff)
Make Identity module more AngularJs Like !
Diffstat (limited to 'client/js/controllers')
-rw-r--r--client/js/controllers/login.js16
-rw-r--r--client/js/controllers/status.js6
2 files changed, 11 insertions, 11 deletions
diff --git a/client/js/controllers/login.js b/client/js/controllers/login.js
index 751bd09..e9308b8 100644
--- a/client/js/controllers/login.js
+++ b/client/js/controllers/login.js
@@ -7,7 +7,7 @@
* @param {sharedProfile} sharedProfile The sharedProfile service
*/
-mainApp.controller('loginCtrl', ['$scope','$sce','$http', 'sharedProfile', function ($scope,$sce, $http, sharedProfile)
+mainApp.controller('loginCtrl', ['$scope','$sce','Identity', function ($scope,$sce, Identity)
{
// Define default states
$('#loginModal').modal({backdrop: 'static', keyboard: false});
@@ -24,23 +24,23 @@ mainApp.controller('loginCtrl', ['$scope','$sce','$http', 'sharedProfile', funct
var password=$("#loginFormPassword").val();
var projectname=$("#loginFormProjectname").val();
- var result=identity.request.login($http,username, password, projectname);
+ var result=Identity.login(username, password, projectname);
result.then(function (response){
// Parser result
- var requestResultObject=identity.requestParser.parseLoginAnswer(response);
+ var requestResultObject=Identity.parseLoginAnswer(response);
// Check for error
if(requestResultObject.status!==0){
- //alert(result.data)
+
$('#failedToLoginAlert').show();
}
else {
- $('#loginModal').modal('hide');
- sharedProfile.username=username;
- sharedProfile.projectname=projectname;
-
+ $('#loginModal').modal('hide');
+ Identity.profile.username=username;
+ Identity.profile.projectname=projectname;
+
}
// Reset button state
diff --git a/client/js/controllers/status.js b/client/js/controllers/status.js
index ce6882e..7425244 100644
--- a/client/js/controllers/status.js
+++ b/client/js/controllers/status.js
@@ -6,9 +6,9 @@
* @param {$scope} $scope The $scope service from angular
* @param {sharedProfile} sharedProfile The sharedProfile build by ourself
*/
-mainApp.controller('statusCtrl', ['$scope','sharedProfile', function ($scope, sharedProfile)
+mainApp.controller('statusCtrl', ['$scope','Identity', function ($scope, Identity)
{
- $scope.profile=sharedProfile;
+ $scope.profile=Identity.profile;
-}]); \ No newline at end of file
+}]);