1 Reply Latest reply on Sep 6, 2011 2:16 AM by ssachtleben.ssachtleben.gmail.com

    How to redirect page request by user loggedin

    rluceac

      HI. I have a developping a site with seam 3 and jboss 7.


      I'm using seam security and faces.


      The front page of the site have the login constrols. When the user enter his credentials he is redirected to his user page /MySC.


      But if the user type just the domain name the / he even loggenin he goes to the front page.


      What I want is that when he logs in, he never can access the front page again. If he request to go to the front page or enter the domain address
      in the location bar I want him to be redirected to /MySC


      How can I do that?:???



      Thanks

        • 1. Re: How to redirect page request by user loggedin
          ssachtleben.ssachtleben.gmail.com


          Add this to your faclet and invoke a method on your action bean:


          <f:metadata>     
               <s:viewAction action="#{myAction.validate}"/>
          </f:metadata>



          On the action side:


          @Inject
          private User user;
          
          public String validate() {
               if (user == null) {
                    return "loggedIn.xhtml"; // for PrettyFaces return mappingId e.g. pretty:loggedIn
               }
               return null;
          }



          Clean and simple solution. I assuming that you have a producer class for the logged in user.