3 Replies Latest reply on Sep 8, 2009 5:29 PM by mcohnen

    Redirect after login, when user clicks the login link

      Hi!


      I'm trying the redirect after login feature, as described in the documentation, and it works pretty good. When the user tries to access a restricted component/view, it gets redirected to the login page, and when successfully loggedIn, it goes back to the previous screen.


      But what if the user simply clicks on a login link? (like the one created by seam-gen)




      <s:link id="menuLoginId" view="/login.xhtml" value="Login" rendered="#{not identity.loggedIn}"/>





      I have tried to add


      action="#{redirect.captureCurrentView}"



      to that link, but it is not working. How can I achieve it? I have been browsing the forum, but haven't been able to find the answer, neither in the documentation.


      sorry if this is an obvious question anyway.


      Thank you!!!!

        • 1. Re: Redirect after login, when user clicks the login link

          I manage to do it by calling to


          #{redirect.captureView}



          in every single site except for /login.xhtml. It seems that adding it to the link is too late, as the view is already /login.xhtml. Is there a cleaner way of achieving this behaviour? (I only want to save the current view if the user clicks the login button, not always except when the user is in the login screen...)


          Thank you!

          • 2. Re: Redirect after login, when user clicks the login link
            pdhaigh

            Why don't you just replace your links that go directly to the login page (/login.xhtml) with links to your default secure page? (e.g. /secure/index.xhtml)


            • 3. Re: Redirect after login, when user clicks the login link

              the thing is that the page is not necessary secure. You can be logged, but you can also not be logged, but I still want the user to be able to login in that page, and then be returned to the page again.


              Think of a final reservation process, where you can anonimously finish it, or still pressing a login button, so that anonimous login form disappears and you have your account information instead...


              Thank you for replying!