2 Replies Latest reply on May 26, 2008 9:09 PM by sudeval

    How add message for authenticate method

    sudeval

      Hi,
      I use seam-gen in my project, i wish that when ocurrs error in my method authenticate,  return a message with the error.



      for example:



      public boolean authenticate() {
       Boolean success = Boolean.TRUE;
       User user = getUser(identity.getUsername());
       if (user == null) {
          success = Boolean.FALSE;
          FacesMessage.instance.add("User not found!");
       }else if (!user.getPassword.equals(identity.getPassword())){
          success = Boolean.FALSE;
          FacesMessage.instance.add("Password Invalid!");
       }
      
       return success;
      



      but when i add the message, the method authenticate is execute twice and in my view is show as below:


      User not found
      Login Failed
      User not found
      ... my form .....................
      . Login:                        .
      .                               .
      . Password:                     .
      .................................
       




      why is execute twice (authenticate) ?
      how i do to show only 'Login failed' and 'user not found' once ?



      ps.: Login failed is the message default for login error.(message.properties)