Make Identity module more AngularJs Like !
This commit is contained in:
parent
1cd1ae92f4
commit
65bcc72059
7 changed files with 63 additions and 82 deletions
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
||||
}]);
|
||||
}]);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue