details: http://code.openbravo.com/erp/devel/pi/rev/59c0ede95a86 changeset: 4647:59c0ede95a86 user: Stefan Hühner <stefan.huehner <at> openbravo.com> date: Wed Aug 19 14:37:33 2009 +0200 summary: Fixed 10320: On logout only remove the #Authenticated_user attribute, if the session has not already been invalidated - If it has not need to do anything otherwiese remove attribute without checking, as removeAttribute is a no-op with the attr missing
diffstat: src/org/openbravo/authentication/basic/DefaultAuthenticationManager.java | 10 +++++++--- 1 files changed, 7 insertions(+), 3 deletions(-) diffs (28 lines): diff -r cfc17b515e4c -r 59c0ede95a86 src/org/openbravo/authentication/basic/DefaultAuthenticationManager.java --- a/src/org/openbravo/authentication/basic/DefaultAuthenticationManager.java Wed Aug 19 08:35:10 2009 +0200 +++ b/src/org/openbravo/authentication/basic/DefaultAuthenticationManager.java Wed Aug 19 14:37:33 2009 +0200 @@ -19,6 +19,7 @@ import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; import org.apache.log4j.Logger; import org.openbravo.authentication.AuthenticationException; @@ -109,10 +110,13 @@ public void logout(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - if (request.getSession().getAttribute("#Authenticated_user") != null - && !request.getSession().getAttribute("#Authenticated_user").equals("")) { - request.getSession(true).removeAttribute("#Authenticated_user"); + + // if HttpSession is still valid, then 'logout' by removing #Authenticated_user from it + HttpSession session = request.getSession(false); + if (session != null) { + session.removeAttribute("#Authenticated_user"); } + if (!response.isCommitted()) response.sendRedirect(HttpBaseUtils.getLocalAddress(request)); } ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Openbravo-commits mailing list Openbravo-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openbravo-commits