1 Reply Latest reply on May 18, 2010 12:47 PM by sappo

    Sample login form

    olasamuel

      Hi All,


      I am new to seam. My first point of departure is that I want to create a login page whereby user will enter there username and password and this will be fetched from the table users. All the samples that I have been seen did not explain how to link this with a table. Can someone please show me how to do this or if possible point me to an example that will show me how to do this. Thank you in advance

        • 1. Re: Sample login form
          sappo

          Hi Olalekan,


          in your authentication bean you can try something like this:


          @In
          EntityManager entityManager;
          @In
          Credentials credentials;
          
          public bool authenticate() {
            String user = credentials.getUsername();
            String pass = credentials.getPassword();
          
            List<User> userList = entityManager.createQuery([Your Query]).getResultList;
            if(userList.isEmpty()) {
              return true;
            } else {
              return false;
            }
          }