6 Replies Latest reply on Mar 26, 2008 10:27 AM by Pete Muir

    Redirect f

    Uwe Müller Newbie

      I have a login page.
      When the login succeds a new conversation is initiated and the user is redirected to the main program page. This works fine.


      Is there a way to directly create a conversation and redirect the user to the main page if
      1. the user already loggen in and
      2. has an active Session and
      3. tries to open the login page?


      I currently use a custom authorisation function.


      Thank you in advance.


      Uwe Müller

        • 1. Re: Redirect f
          Nicklas Karlsson Master

          how about an if-navigation rule on identity.loggedIn that redirects you?

          • 2. Re: Redirect f
            Uwe Müller Newbie

            I already have an if navigation rule in my pages.xml file
            But this only seems to be evaluated after the login button is pressed.


                <page view-id="/home.xhtml">
                    <navigation>
                        <rule if="#{userSession.loggedIn}">
                            <redirect view-id="/workspace.xhtml"/>
                        </rule>
                    </navigation>
                </page>



            A page action itself may be executed at start, but how is possible to initiate a conversation, save some Data in this conversation and redirect to workspace.xhtml if the session is already open.

            • 3. Re: Redirect f
              Pete Muir Master

              Use a page action, the evaluated before you render the page.

              • 4. Re: Redirect f
                Uwe Müller Newbie

                I tried a solution with a page action.
                But how can a page action create a new conversation only if the user already has a session and then perform a redirect?


                My current solution is to include javascript that will click the login button on the first page if the user already logged in.

                • 5. Re: Redirect f
                  Dean Hiller Expert

                  I was also wondering this myself.  did you solve this.  I actually tried to have my action throw an exception that should have been caught and redirected by my exception handler.  Originally my login page worked and rendered fine...once I added the code to throw exception in redirect, the login page no longer works for someone not logged in.  when it tries to render, I get @In attribute requires non-null value: login.user which is really funny because the action has nothing to do with the login component...ie. no changes to login component are made.  I just remove the action and it works again, put back the action and the navigation component fails.

                  • 6. Re: Redirect f
                    Pete Muir Master

                    What version of Seam? This sounds like a bug in exception handling.