You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by do...@apache.org on 2013/05/14 00:30:47 UTC
svn commit: r1482128 -
/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/LoginWorker.java
Author: doogie
Date: Mon May 13 22:30:47 2013
New Revision: 1482128
URL: http://svn.apache.org/r1482128
Log:
FEATURE: Split checkLogin, creating checkLogout, which is a helper
method that returns a valid UserLogin entity, or null if permissions or
other reasons cause it to be invalid for the current scenario.
Modified:
ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/LoginWorker.java
Modified: ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/LoginWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/LoginWorker.java?rev=1482128&r1=1482127&r2=1482128&view=diff
==============================================================================
--- ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/LoginWorker.java (original)
+++ ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/control/LoginWorker.java Mon May 13 22:30:47 2013
@@ -213,14 +213,8 @@ public class LoginWorker {
}
/**
- * An HTTP WebEvent handler that checks to see is a userLogin is logged in.
- * If not, the user is forwarded to the login page.
- *
- * @param request The HTTP request object for the current JSP or Servlet request.
- * @param response The HTTP response object for the current JSP or Servlet request.
- * @return String
*/
- public static String checkLogin(HttpServletRequest request, HttpServletResponse response) {
+ public static GenericValue checkLogout(HttpServletRequest request, HttpServletResponse response) {
HttpSession session = request.getSession();
GenericValue userLogin = (GenericValue) session.getAttribute("userLogin");
@@ -236,11 +230,23 @@ public class LoginWorker {
Debug.logInfo("User does not have permission or is flagged as logged out", module);
doBasicLogout(userLogin, request, response);
userLogin = null;
-
- // have to reget this because the old session object will be invalid
- session = request.getSession();
}
}
+ return userLogin;
+ }
+
+ /**
+ * An HTTP WebEvent handler that checks to see is a userLogin is logged in.
+ * If not, the user is forwarded to the login page.
+ *
+ * @param request The HTTP request object for the current JSP or Servlet request.
+ * @param response The HTTP response object for the current JSP or Servlet request.
+ * @return String
+ */
+ public static String checkLogin(HttpServletRequest request, HttpServletResponse response) {
+ GenericValue userLogin = checkLogout(request, response);
+ // have to reget this because the old session object will be invalid
+ HttpSession session = request.getSession();
String username = null;
String password = null;