diff --git a/trunk/SiprpWebFichasClinicas/WebContent/static/html/app/Login/LoginController.js b/trunk/SiprpWebFichasClinicas/WebContent/static/html/app/Login/LoginController.js index e541dbec..dcae95c5 100644 --- a/trunk/SiprpWebFichasClinicas/WebContent/static/html/app/Login/LoginController.js +++ b/trunk/SiprpWebFichasClinicas/WebContent/static/html/app/Login/LoginController.js @@ -15,49 +15,54 @@ pass: '' }; - //login procedure ---> user clicks the Login button - $scope.login = function(arg) { - - $rootScope.$broadcast('loadingStatusActive'); - - $scope.selected = {}; - - $scope.iaLoginMessages.hide(); - - $scope.storeLogin.upsert({}, $scope.editing, function(response, selected, editing, isNewRecord){ - - $rootScope.$broadcast('loadingStatusInactive'); - - if(response.success) - { - if($scope.$parent.sessionTimeout) - { - //go to previous module before timeout... - var className = $scope.$parent.beforeSessionTimeoutModule.ClassName; - - $scope.$parent.loadModule({Controller: className}, function(className, scope, isNewModule){ - - $scope.$parent.sessionTimeout = false; - $scope.$parent.beforeSessionTimeoutModule = null; - }); - } - else - { - $rootScope.$emit('onloginsuccessfull', {response: response}); - } - } - else - { - if(response.messages.length > 0) - { - var firstMessage = response.messages[0].messageData; - - $scope.iaLoginMessages.message = firstMessage; - $scope.iaLoginMessages.cssClass = 'bg-danger'; - $scope.iaLoginMessages.show(); - } - } - }); + $scope.login = function(e) { + + var isValid = $scope.editForm.$isValid(); + + if(isValid) + { + $rootScope.$broadcast('loadingStatusActive'); + + $scope.selected = {}; + + $scope.iaLoginMessages.hide(); + + $scope.storeLogin.upsert({}, $scope.editing, function(response, selected, editing, isNewRecord){ + + $rootScope.$broadcast('loadingStatusInactive'); + + if(response.success) + { + if($scope.$parent.sessionTimeout) + { + //go to previous module before timeout... + var className = $scope.$parent.beforeSessionTimeoutModule.ClassName; + + $scope.$parent.loadModule({Controller: className}, function(className, scope, isNewModule){ + + $scope.$parent.sessionTimeout = false; + $scope.$parent.beforeSessionTimeoutModule = null; + }); + } + else + { + $rootScope.$emit('onloginsuccessfull', {response: response}); + } + } + else + { + if(response.messages.length > 0) + { + var firstMessage = response.messages[0].messageData; + + $scope.iaLoginMessages.message = firstMessage; + $scope.iaLoginMessages.cssClass = 'bg-danger'; + $scope.iaLoginMessages.show(); + } + } + }); + + } }; $scope.$on('afterrender', function(event, args){ diff --git a/trunk/SiprpWebFichasClinicas/WebContent/static/html/app/Login/LoginView.html b/trunk/SiprpWebFichasClinicas/WebContent/static/html/app/Login/LoginView.html index ff878b8c..fe381774 100644 --- a/trunk/SiprpWebFichasClinicas/WebContent/static/html/app/Login/LoginView.html +++ b/trunk/SiprpWebFichasClinicas/WebContent/static/html/app/Login/LoginView.html @@ -5,6 +5,7 @@