2 Replies Latest reply on Jul 9, 2007 8:06 AM by chibi

    how can login automatically after register?

    chibi

      i try to use the code like below, but failed

      @PersistenceContext
      private EntityManager em;
      
      @In Identity identity;
      .....
      
      public String register(){
       .....
       em.persist(user);
       identity.setUsername(user.getUsername);
       identity.setPassword(user.getPassword);
       identity.login();
       return "/home.seam";
      }
      
      


      the same question is i try to recieve username and password from a SSO system, but failed again when i use identity.login()
      @RequestParameter private String ssoString;
      
      @Create
      public sso(){
       User user = SSO.parser(ssoString);
       if(user.isValid()){
       identity.setUsername(user.getUsername);
       identity.setPassword(user.getPassword);
       identity.login();
       }
       Redirect redirect = Redirect.instance();
       redirect.setViewId("/home.xhtml");
       redirect.execute();
      }