[Opensource] CurrentLogin problems

Tino Dai tdai at optonline.net
Thu Jun 19 08:01:19 PDT 2003


Hi Everyone,

    I got my program working with CurrentLogin, but it doesn't work for
multi-users such as user mike and oberoc logged in at the same time.
Could tell me the correct way of doing this. I have snippets of my code
below: The explanation is I used the session object to physically remove
and add back in the Currentlogin. It seems that there is only one
instance  of the session. I don't have a clue on how to fix this.

ServletControllerRequest sr = (ServletControllerRequest) request;
HttpServletRequest hreq = (HttpServletRequest) sr.getServletRequest();
        
myUser.setField("username",request.getParameter("UserName"));
 if ( myUser.find() ) {
  String tempPass=myUser.getField("password");
  if (tempPass.equals(request.getParameter("PassWord"))) {
    CurrentLogin myLogin = new CurrentLogin(GenericSession.getId(hreq),
                           request.getParameter("UserName"),
                           hreq.getRemoteAddr(),request.getDBName(),
                           System.currentTimeMillis(),
                           myUser.getFieldInt("uid"));
    PersistentSession session = request.getSession();
    session.removePersistentAttribute("CurrentLogin");
    session.setPersistentAttribute("CurrentLogin",myLogin);

Thanks in advance,
Tino





More information about the Opensource mailing list