# HG changeset patch
# User Rafa Alonso <rafael.alonso@openbravo.com>
# Date 1426889673 -3600
#      Fri Mar 20 23:14:33 2015 +0100
# Node ID 7ce89eea4437a262384e6424b9eff069aede1e69
# Parent  659a181012e38226c00f71dcc87dd699bd2e7331
Fixes issue 29366: Prevent the login process from being executed when it is already in progress

diff -r 659a181012e3 -r 7ce89eea4437 web/org.openbravo.mobile.core/source/model/ob-terminal-model.js
--- a/web/org.openbravo.mobile.core/source/model/ob-terminal-model.js	Fri Mar 20 18:04:14 2015 +0100
+++ b/web/org.openbravo.mobile.core/source/model/ob-terminal-model.js	Fri Mar 20 23:14:33 2015 +0100
@@ -1054,6 +1054,13 @@ OB.Model.Terminal = Backbone.Model.exten
   },
 
   login: function (user, password, mode) {
+    if (this.get('isLoggingIn') === true) {
+      OB.UTIL.Debug.execute(function () {
+        throw "There is already a logging process in progress";
+      });
+      return;
+    }
+    this.set('isLoggingIn', true);
     var params;
     OB.UTIL.showLoading(true);
     var me = this;
@@ -1062,7 +1069,6 @@ OB.Model.Terminal = Backbone.Model.exten
 
     // invoking app specific actions
     this.preLoginActions();
-    this.set('isLoggingIn', true);
 
     params = this.get('loginUtilsParams') || {};
     params.user = user;
