details:   https://code.openbravo.com/erp/devel/pi/rev/0c885bc2fcec
changeset: 35310:0c885bc2fcec
user:      Carlos Aristu <carlos.aristu <at> openbravo.com>
date:      Mon Jan 14 10:37:29 2019 +0100
summary:   fixes bug 39885: link to a document isn't followed properly after 
login

  Before[1] the URL query string used to specify the link to a concrete 
document was being stored in session. After that changeset the code to save 
that value in session was no longer being executed, so it was not possible to 
recover the document link information.

  To solve this problem now we keep the query string with the link information 
in the URL, and we retrieve it from there when needed.


  [1] 
https://code.openbravo.com/erp/devel/pi/rev/6d6a3a710fd21bbc60de46c5778b212c64ec300c

diffstat:

 src/index.jsp                                      |   8 ++++++--
 src/org/openbravo/base/secureApp/LoginHandler.java |   5 ++---
 src/org/openbravo/erpCommon/security/Login.html    |   4 ++--
 web/js/login.js                                    |  14 ++++++++------
 web/js/utils.js                                    |   4 ++--
 5 files changed, 20 insertions(+), 15 deletions(-)

diffs (138 lines):

diff -r 9a417375877c -r 0c885bc2fcec src/index.jsp
--- a/src/index.jsp     Fri Jan 11 09:54:50 2019 +0100
+++ b/src/index.jsp     Mon Jan 14 10:37:29 2019 +0100
@@ -32,7 +32,7 @@
  * under the License. 
  * The Original Code is Openbravo ERP. 
  * The Initial Developer of the Original Code is Openbravo SLU 
- * All portions are Copyright (C) 2011-2018 Openbravo SLU
+ * All portions are Copyright (C) 2011-2019 Openbravo SLU
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -45,7 +45,11 @@
 
 AuthenticationManager authManager = 
AuthenticationManager.getAuthenticationManager(this);
 if (!adSessionPresent && !authManager.useExternalLoginPage()) {
-  response.sendRedirect(authManager.getLoginURL(request));
+  if (request.getQueryString() != null) {
+    response.sendRedirect(authManager.getLoginURL(request) + "?" + 
request.getQueryString());
+  } else {
+    response.sendRedirect(authManager.getLoginURL(request));
+  }
   return;
 }
 
diff -r 9a417375877c -r 0c885bc2fcec 
src/org/openbravo/base/secureApp/LoginHandler.java
--- a/src/org/openbravo/base/secureApp/LoginHandler.java        Fri Jan 11 
09:54:50 2019 +0100
+++ b/src/org/openbravo/base/secureApp/LoginHandler.java        Mon Jan 14 
10:37:29 2019 +0100
@@ -1,7 +1,6 @@
 /*
  
************************************************************************************
-
- * Copyright (C) 2001-2018 Openbravo S.L.U.
+ * Copyright (C) 2001-2019 Openbravo S.L.U.
  * Licensed under the Apache Software License version 2.0
  * You may obtain a copy of the License at 
http://www.apache.org/licenses/LICENSE-2.0
  * Unless required by applicable law or agreed to  in writing,  software  
distributed
@@ -401,7 +400,7 @@
       }
 
       String target = getUserStartPage(strUserAuth, userLoginDefaults,
-          vars.getSessionValue("target"), 
vars.getSessionValue("targetQueryString"));
+          vars.getSessionValue("target"), 
vars.getStringParameter("targetQueryString"));
       vars.removeSessionValue("target");
 
       goToTarget(res, target);
diff -r 9a417375877c -r 0c885bc2fcec 
src/org/openbravo/erpCommon/security/Login.html
--- a/src/org/openbravo/erpCommon/security/Login.html   Fri Jan 11 09:54:50 
2019 +0100
+++ b/src/org/openbravo/erpCommon/security/Login.html   Mon Jan 14 10:37:29 
2019 +0100
@@ -11,7 +11,7 @@
  * under the License. 
  * The Original Code is Openbravo ERP. 
  * The Initial Developer of the Original Code is Openbravo SLU 
- * All portions are Copyright (C) 2010-2018 Openbravo SLU 
+ * All portions are Copyright (C) 2010-2019 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -55,7 +55,7 @@
 var recBrowserSafari = '12.0.0.0';
 
 // currentRevision must be the same value as the one returned by 
getCurrentRevision() (see utils.js)
-var currentRevision = '33640';
+var currentRevision = '35310';
 
 beforeLoadDo();
 </script>
diff -r 9a417375877c -r 0c885bc2fcec web/js/login.js
--- a/web/js/login.js   Fri Jan 11 09:54:50 2019 +0100
+++ b/web/js/login.js   Mon Jan 14 10:37:29 2019 +0100
@@ -11,7 +11,7 @@
  * under the License. 
  * The Original Code is Openbravo ERP. 
  * The Initial Developer of the Original Code is Openbravo SLU 
- * All portions are Copyright (C) 2017-2018 Openbravo SLU 
+ * All portions are Copyright (C) 2017-2019 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -70,6 +70,7 @@
 }
 
 function doLogin(command) {
+  var extraParams;
   if (document.getElementById('resetPassword').value === 'true' && 
document.getElementById('user').value !== 
document.getElementById('password').value) {
     setLoginMessage('Error', errorSamePassword, 
errorDifferentPasswordInFields);
     return true;
@@ -91,12 +92,17 @@
     }
     disableButton('buttonOK');
     command = command || (document.getElementById('resetPassword').value === 
'true' ? 'FORCE_RESET_PASSWORD' : 'DEFAULT');
-    submitXmlHttpRequest(loginResult, document.frmIdentificacion, command, 
'../secureApp/LoginHandler.html', false, null, null);
+    extraParams = '&targetQueryString=' + getURLQueryString();
+    submitXmlHttpRequest(loginResult, document.frmIdentificacion, command, 
'../secureApp/LoginHandler.html', false, extraParams, null);
   }
 
   return false;
 }
 
+function getURLQueryString() {
+  return encodeURIComponent(window.location.search.substr(1));
+}
+
 function loginResult(paramXMLParticular, XMLHttpRequestObj) {
   var strText = '';
   if (getReadyStateHandler(XMLHttpRequestObj, null, false)) {
@@ -513,10 +519,6 @@
  */
 
 function submitXmlHttpRequest(callbackFunction, formObject, Command, Action, 
debug, extraParams, paramXMLReq) {
-  submitXmlHttpRequestWithParams(callbackFunction, formObject, Command, 
Action, debug, null, paramXMLReq);
-}
-
-function submitXmlHttpRequestWithParams(callbackFunction, formObject, Command, 
Action, debug, extraParams, paramXMLReq) {
   var XMLHttpRequestObj = null;
   XMLHttpRequestObj = getXMLHttpRequest();
   if (formObject === null) {
diff -r 9a417375877c -r 0c885bc2fcec web/js/utils.js
--- a/web/js/utils.js   Fri Jan 11 09:54:50 2019 +0100
+++ b/web/js/utils.js   Mon Jan 14 10:37:29 2019 +0100
@@ -11,7 +11,7 @@
  * under the License.
  * The Original Code is Openbravo ERP.
  * The Initial Developer of the Original Code is Openbravo SLU
- * All portions are Copyright (C) 2001-2018 Openbravo SLU
+ * All portions are Copyright (C) 2001-2019 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -105,7 +105,7 @@
 * Return a number that would be checked at the Login screen to know if the 
file is cached with the correct version
 */
 function getCurrentRevision() {
-  var number = '33640';
+  var number = '35310';
   return number;
 }
 


_______________________________________________
Openbravo-commits mailing list
Openbravo-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to