41 lines
1,011 B
JavaScript
41 lines
1,011 B
JavaScript
|
|
/**
|
|
* Represents a book.
|
|
* @constructor
|
|
*/
|
|
mainApp.controller('loginCtrl', function ($scope,$interval,$sce)
|
|
{
|
|
// 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.login($("#loginFormUsername").val(), $("#loginFormProjectname").val(), $("#loginFormPassword").val());
|
|
|
|
|
|
$interval(
|
|
function()
|
|
{
|
|
// Check for error
|
|
if(!errors.checkForLogin(result)){
|
|
$('#failedToLoginAlert').show();
|
|
}
|
|
else {
|
|
$('#loginModal').modal('hide');
|
|
}
|
|
|
|
// Reset button state
|
|
$('#loginButton').show();
|
|
$('#loadingLoginButton').hide();
|
|
}, 2000,1);
|
|
|
|
|
|
|
|
});
|
|
});
|