Add sharedProfile service
This commit is contained in:
parent
a16df328c0
commit
cca5df968e
8 changed files with 42 additions and 33 deletions
|
@ -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();
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
});
|
||||
});
|
||||
}]);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue