1 Reply Latest reply on Jul 12, 2010 11:25 PM by Herberson Silva

    Problem to login a newly created user

    chris perrin Newbie

      Hi,


      could someone please try to explain me why the following code does not work. It is very similar to some code on the seamspace example but in my case identity.login() is returning not logged in



      @Name("register")
      @Scope(ScopeType.CONVERSATION)
      public class Register {
      
          @In
          IdentityManager identityManager;
      
          @In
          private Identity identity;
      
          @Logger
          private static Log log;
      
          @Begin
          public String register() {
      
              new RunAsOperation() {
      
                  @Override
                  public void execute() {
                      identityManager.createUser("testuser@test.com", "password");
                  }
              }.addRole("admin").run();
      
              identity.getCredentials().setUsername("testuser@test.com");
              identity.getCredentials().setPassword("password");
              String res = identity.login();
      
              return res;
          }
      }



      I guess I am missing something and I would be very grateful if someone could help me out


      Thanks
      Chris