summaryrefslogtreecommitdiff
path: root/client/js/controllers
diff options
context:
space:
mode:
Diffstat (limited to 'client/js/controllers')
-rw-r--r--client/js/controllers/login.js19
-rw-r--r--client/js/controllers/status.js24
2 files changed, 17 insertions, 26 deletions
diff --git a/client/js/controllers/login.js b/client/js/controllers/login.js
index 07f1d19..3447ab1 100644
--- a/client/js/controllers/login.js
+++ b/client/js/controllers/login.js
@@ -3,24 +3,27 @@
* Represents a book.
* @constructor
*/
-mainApp.controller('loginCtrl', function ($scope,$interval,$sce, $http)
+mainApp.controller('loginCtrl', ['$scope','$sce','$http', 'sharedProfile', function ($scope,$sce, $http, sharedProfile)
{
// Define default states
$('#loginModal').modal({backdrop: 'static', keyboard: false});
$('#loadingLoginButton').hide();
$('#failedToLoginAlert').hide();
-
+
$('#loginButton').click(function(){
$('#loginButton').hide();
$('#loadingLoginButton').show();
$('#failedToLoginAlert').hide();
- var result=identity.request.login($http,$("#loginFormUsername").val(), $("#loginFormProjectname").val(), $("#loginFormPassword").val());
+ var username=$("#loginFormUsername").val();
+ var password=$("#loginFormPassword").val();
+ var projectname=$("#loginFormProjectname").val();
+
+ var result=identity.request.login($http,username, password, projectname);
result.then(function (response){
-
// Parser result
var requestResultObject=identity.requestParser.parseLoginAnswer(response);
@@ -31,21 +34,23 @@ mainApp.controller('loginCtrl', function ($scope,$interval,$sce, $http)
}
else {
$('#loginModal').modal('hide');
+ sharedProfile.username=username;
+ sharedProfile.projectname=projectname;
+
}
// Reset button state
$('#loginButton').show();
$('#loadingLoginButton').hide();
},function(response){
-
$('#failedToLoginAlert').show();
// Reset button state
$('#loginButton').show();
$('#loadingLoginButton').hide();
});
-
+
});
-});
+}]);
diff --git a/client/js/controllers/status.js b/client/js/controllers/status.js
index 42a54d4..4ffdb6b 100644
--- a/client/js/controllers/status.js
+++ b/client/js/controllers/status.js
@@ -4,25 +4,11 @@
-mainApp.controller('statusCtrl', function ($scope,$interval,$sce)
-{
- $scope.username="John Doe";
- $scope.projectname="Web Server";
- // Update status every 2 seconds
- /*$interval(function(){
- var status=identity.fetchStatus();
- $scope.username=status[1];
- $scope.lastconnection=status[2];
- if(status[0] == "1"){
- $scope.connection=$sce.trustAsHtml("<span style=\"color:green;\">Online</span>");
- }
- else{
- $scope.connection=$sce.trustAsHtml("<span style=\"color:red;\">Offline</span>");
- }
- }, 2000);*/
-
+mainApp.controller('statusCtrl', ['$scope','sharedProfile', function ($scope, sharedProfile)
+{
+ $scope.profile=sharedProfile;
+
-
-}); \ No newline at end of file
+}]); \ No newline at end of file