Make Identity module more AngularJs Like !

This commit is contained in:
manzerbredes 2016-02-10 17:47:01 +01:00
parent 1cd1ae92f4
commit 65bcc72059
7 changed files with 63 additions and 82 deletions

View file

@ -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

View file

@ -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;
}]);
}]);