1 Reply Latest reply on Feb 22, 2010 3:22 PM by fesi

    RememberMe autoLogin mode problem

    bartw

      Hi


      I am trying to setup autologin mode for RememberMe component. Configuration is done as described in seam documentation. Unfortunately I am experiencing exactly the same problems like many others before me. This is, for example, quite well described here:


      Problem with autologin


      Summing up, the quiet login works, user seems to be logged in, then Pages.redirectToLoginView() takes control again and redirects to login.
      So I would like to ask whether I did overlook something in configuration or some additional magic is required here to workaround this issue :)


      thanks for any help/hints


      Regards,
      Bartek

        • 1. Re: RememberMe autoLogin mode problem
          fesi

          Hi Bartek


          I see two possible work-arounds for this problem:


          1. Replace the Pages component by your own implementation, which replaces the method isLoginRedirectRequired(String viewId, Page page) as follows:



          Old:
          private boolean isLoginRedirectRequired(String viewId, Page page)
          {
             return page.isLoginRequired() && 
                   !viewId.equals( getLoginViewId() ) && 
                   !Identity.instance().isLoggedIn();
          }
          
          New:
          private boolean isLoginRedirectRequired(String viewId, Page page)
          {
             if (page.isLoginRequired() && !viewId.equals( getLoginViewId() ) && !Identity.instance().isLoggedIn()) {
                notLoggedIn();
                 if (!Identity.instance().isLoggedIn()) {
                    return true;
                }
             }
             return false;
          }




          Unfortunately this method is private, so you cannot just override it :-(


          2. Add a page action to the login page, which fires a loginSuccessful event, if the user is already logged in, resulting in a call to Redirect.redirectToCapturedView().


          I chose the second approach.


          Regards,
          Felix