This commit is contained in:
Loic GUEGAN 2016-04-16 22:06:18 +02:00
parent a3ff4d243e
commit 21b68f1da1
3 changed files with 77 additions and 78 deletions

View file

@ -1,6 +1,6 @@
<head>
<script src="../vendors/angularjs/angular.min.js"></script>
<script src="../vendors/angularjs/angular.min.js"></script>
<script src="../vendors/angularjs/angular-route.min.js"></script>
<script src="../vendors/angularjs/angular-sanitize.min.js"></script>
<script src="../vendors/angularjs/angular-cookies.min.js"></script>

View file

@ -23,7 +23,7 @@
<div ng-include="'./partials/login.html'"></div>
<div ng-include="'./partials/home/machineDetails.html'"></div>
<div ng-include="'./partials/loading.html'"></div>
<div ng-include="'./partials/image/upload.html'"></div>
<div ng-include="'./partials/image/upload.html'"></div>
<!-- MAIN GRID -->

View file

@ -7,15 +7,15 @@
* @param {Identity} The Identity service
*/
mainApp.controller('loginCtrl', ['$scope','$sce','Identity', function ($scope,$sce, Identity)
{
mainApp.controller('loginCtrl', ['$scope', '$sce', 'Identity', function ($scope, $sce, Identity)
{
// Check for login and define default states
if(!Identity.isAlreadyLogin()){
if (!Identity.isAlreadyLogin()) {
$('#loginModal').modal({backdrop: 'static', keyboard: false});
}
// Manager logout event
$scope.$on('logoutEvent', function(){
$scope.$on('logoutEvent', function () {
$('#loginModal').modal({backdrop: 'static', keyboard: false});
});
@ -27,7 +27,7 @@ mainApp.controller('loginCtrl', ['$scope','$sce','Identity', function ($scope,$s
// Defined function for login
$scope.loginAction=function(){
$scope.loginAction = function () {
// Begin login state for template
$('#loginButton').hide();
@ -35,21 +35,20 @@ mainApp.controller('loginCtrl', ['$scope','$sce','Identity', function ($scope,$s
$('#failedToLoginAlert').hide();
// Get data from templates
var username=$("#loginFormUsername").val();
var password=$("#loginFormPassword").val();
var projectname=$("#loginFormProjectname").val();
var username = $("#loginFormUsername").val();
var password = $("#loginFormPassword").val();
var projectname = $("#loginFormProjectname").val();
// Function to call to handle result
var responseCallback=function(response){
var responseCallback = function (response) {
if(response.status!==0){
if (response.status !== 0) {
// Set reason of fail
$scope.failReason=response.failReason;
$scope.failReason = response.failReason;
// Display the error
$('#failedToLoginAlert').show();
}
else {
} else {
// Else the user is online !
$('#loginModal').modal('hide');
}
@ -63,4 +62,4 @@ mainApp.controller('loginCtrl', ['$scope','$sce','Identity', function ($scope,$s
Identity.login(username, password, projectname, responseCallback);
};
}]);
}]);