From 1c7ef515a674dae15f0884f82f4378dbdc0dfe2b Mon Sep 17 00:00:00 2001 From: Jacques Le Roux Date: Fri, 16 Mar 2018 09:36:18 +0000 Subject: [PATCH] "Applied fix from trunk for revision: 1826938 " ------------------------------------------------------------------------ r1826938 | jleroux | 2018-03-16 10:35:06 +0100 (ven., 16 mars 2018) | 12 lines Fixed: Logout do not remove autoLogin (OFBIZ-4959) I used the only available (and I must say confusing) WebappInfo.getName() when I needed the webAppName not the WebappInfoName. So this put in a new WebappInfo.getMountPoint() and use it in getWebappInfo Also use LoginWorker.autoLoginSet() in different places where I missed it. In other words all autoUserLogin coockies are deleted on login and logout, and an autoUserLogin cookie is created when going locally from a webapp to another, with checkExternalLoginKey ------------------------------------------------------------------------ git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/branches/release17.12@1826939 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/ofbiz/base/component/ComponentConfig.java | 7 ++++++- .../ofbiz/webapp/control/ExternalLoginKeysManager.java | 6 +++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/component/ComponentConfig.java b/framework/base/src/main/java/org/apache/ofbiz/base/component/ComponentConfig.java index d5390c9fc5..c09bbc8b98 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/component/ComponentConfig.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/component/ComponentConfig.java @@ -316,7 +316,8 @@ public final class ComponentConfig { WebappInfo webappInfo = null; List webappsInfo = getAppBarWebInfos(serverName); for(WebappInfo currApp : webappsInfo) { - if (webAppName.equals(currApp.getName())) { + String currWebAppName = currApp.getMountPoint().replace("/", "").replace("*", ""); + if (webAppName.equals(currWebAppName)) { webappInfo = currApp; break; } @@ -944,6 +945,10 @@ public final class ComponentConfig { return name; } + public String getMountPoint() { + return mountPoint; + } + public String getTitle() { return title; } diff --git a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/ExternalLoginKeysManager.java b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/ExternalLoginKeysManager.java index c5fd518f63..1ffb9650fc 100644 --- a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/ExternalLoginKeysManager.java +++ b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/ExternalLoginKeysManager.java @@ -157,7 +157,8 @@ public class ExternalLoginKeysManager { GenericValue currentUserLogin = (GenericValue) session.getAttribute("userLogin"); if (currentUserLogin != null) { if (currentUserLogin.getString("userLoginId").equals(userLogin.getString("userLoginId"))) { - // is the same user, just carry on... + // same user, just make sure the autoUserLogin is set to the same and that the client cookie has the correct userLoginId + LoginWorker.autoLoginSet(request, response); return "success"; } @@ -171,6 +172,9 @@ public class ExternalLoginKeysManager { Debug.logWarning("Could not find userLogin for external login key: " + externalKey, module); } + // make sure the autoUserLogin is set to the same and that the client cookie has the correct userLoginId + LoginWorker.autoLoginSet(request, response); + return "success"; }