Test
This commit is contained in:
parent
a3ff4d243e
commit
21b68f1da1
3 changed files with 77 additions and 78 deletions
client/js/controllers
|
@ -5,62 +5,61 @@
|
|||
* @param {$sce} $sce The $sce angular service
|
||||
* @param {$http} $http The $http angular service
|
||||
* @param {Identity} The Identity service
|
||||
|
||||
|
||||
*/
|
||||
mainApp.controller('loginCtrl', ['$scope','$sce','Identity', function ($scope,$sce, Identity)
|
||||
{
|
||||
// Check for login and define default states
|
||||
if(!Identity.isAlreadyLogin()){
|
||||
$('#loginModal').modal({backdrop: 'static', keyboard: false});
|
||||
}
|
||||
mainApp.controller('loginCtrl', ['$scope', '$sce', 'Identity', function ($scope, $sce, Identity)
|
||||
{
|
||||
// Check for login and define default states
|
||||
if (!Identity.isAlreadyLogin()) {
|
||||
$('#loginModal').modal({backdrop: 'static', keyboard: false});
|
||||
}
|
||||
|
||||
// Manager logout event
|
||||
$scope.$on('logoutEvent', function(){
|
||||
$('#loginModal').modal({backdrop: 'static', keyboard: false});
|
||||
});
|
||||
// Manager logout event
|
||||
$scope.$on('logoutEvent', function () {
|
||||
$('#loginModal').modal({backdrop: 'static', keyboard: false});
|
||||
});
|
||||
|
||||
|
||||
|
||||
// Hide loading button and message alert
|
||||
$('#loadingLoginButton').hide();
|
||||
$('#failedToLoginAlert').hide();
|
||||
|
||||
|
||||
// Defined function for login
|
||||
$scope.loginAction=function(){
|
||||
|
||||
// Begin login state for template
|
||||
$('#loginButton').hide();
|
||||
$('#loadingLoginButton').show();
|
||||
// Hide loading button and message alert
|
||||
$('#loadingLoginButton').hide();
|
||||
$('#failedToLoginAlert').hide();
|
||||
|
||||
// Get data from templates
|
||||
var username=$("#loginFormUsername").val();
|
||||
var password=$("#loginFormPassword").val();
|
||||
var projectname=$("#loginFormProjectname").val();
|
||||
|
||||
// Function to call to handle result
|
||||
var responseCallback=function(response){
|
||||
// Defined function for login
|
||||
$scope.loginAction = function () {
|
||||
|
||||
if(response.status!==0){
|
||||
// Set reason of fail
|
||||
$scope.failReason=response.failReason;
|
||||
// Begin login state for template
|
||||
$('#loginButton').hide();
|
||||
$('#loadingLoginButton').show();
|
||||
$('#failedToLoginAlert').hide();
|
||||
|
||||
// Display the error
|
||||
$('#failedToLoginAlert').show();
|
||||
}
|
||||
else {
|
||||
// Else the user is online !
|
||||
$('#loginModal').modal('hide');
|
||||
// Get data from templates
|
||||
var username = $("#loginFormUsername").val();
|
||||
var password = $("#loginFormPassword").val();
|
||||
var projectname = $("#loginFormProjectname").val();
|
||||
|
||||
// Function to call to handle result
|
||||
var responseCallback = function (response) {
|
||||
|
||||
if (response.status !== 0) {
|
||||
// Set reason of fail
|
||||
$scope.failReason = response.failReason;
|
||||
|
||||
// Display the error
|
||||
$('#failedToLoginAlert').show();
|
||||
} else {
|
||||
// Else the user is online !
|
||||
$('#loginModal').modal('hide');
|
||||
}
|
||||
|
||||
// Reset button state
|
||||
$('#loginButton').show();
|
||||
$('#loadingLoginButton').hide();
|
||||
}
|
||||
|
||||
// Reset button state
|
||||
$('#loginButton').show();
|
||||
$('#loadingLoginButton').hide();
|
||||
}
|
||||
|
||||
// Try to login
|
||||
Identity.login(username, password, projectname, responseCallback);
|
||||
};
|
||||
|
||||
}]);
|
||||
// Try to login
|
||||
Identity.login(username, password, projectname, responseCallback);
|
||||
};
|
||||
|
||||
}]);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue