Author: jacopoc
Date: Tue Dec 27 15:17:47 2016
New Revision: 1776148
URL:
http://svn.apache.org/viewvc?rev=1776148&view=revLog:
Improved: minor changes to make the method easier to test with unit tests.
Modified:
ofbiz/trunk/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/ExternalLoginKeysManager.java
Modified: ofbiz/trunk/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/ExternalLoginKeysManager.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/ExternalLoginKeysManager.java?rev=1776148&r1=1776147&r2=1776148&view=diff==============================================================================
--- ofbiz/trunk/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/ExternalLoginKeysManager.java (original)
+++ ofbiz/trunk/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/ExternalLoginKeysManager.java Tue Dec 27 15:17:47 2016
@@ -104,8 +104,6 @@ public class ExternalLoginKeysManager {
* @return - &success& in all the cases
*/
public static String checkExternalLoginKey(HttpServletRequest request, HttpServletResponse response) {
- HttpSession session = request.getSession();
-
String externalKey = request.getParameter(EXTERNAL_LOGIN_KEY_ATTR);
if (externalKey == null) return "success";
@@ -117,12 +115,13 @@ public class ExternalLoginKeysManager {
String oldDelegatorName = delegator.getDelegatorName();
if (!oldDelegatorName.equals(userLogin.getDelegator().getDelegatorName())) {
delegator = DelegatorFactory.getDelegator(userLogin.getDelegator().getDelegatorName());
- LocalDispatcher dispatcher = WebAppUtil.makeWebappDispatcher(session.getServletContext(), delegator);
+ LocalDispatcher dispatcher = WebAppUtil.makeWebappDispatcher(request.getServletContext(), delegator);
LoginWorker.setWebContextObjects(request, response, delegator, dispatcher);
}
// found userLogin, do the external login...
// if the user is already logged in and the login is different, logout the other user
+ HttpSession session = request.getSession();
GenericValue currentUserLogin = (GenericValue) session.getAttribute("userLogin");
if (currentUserLogin != null) {
if (currentUserLogin.getString("userLoginId").equals(userLogin.getString("userLoginId"))) {