istic-openstack/client/js/controllers/login.js

42 lines
1,011 B
JavaScript
Raw Normal View History

2016-02-03 18:57:20 +01:00
/**
* 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();
2016-02-03 17:16:36 +01:00
var result=identity.login($("#loginFormUsername").val(), $("#loginFormProjectname").val(), $("#loginFormPassword").val());
2016-02-03 17:16:36 +01:00
$interval(
function()
{
// Check for error
if(!errors.checkForLogin(result)){
$('#failedToLoginAlert').show();
}
else {
$('#loginModal').modal('hide');
}
// Reset button state
$('#loginButton').show();
$('#loadingLoginButton').hide();
}, 2000,1);
2016-02-03 17:16:36 +01:00
});
});