Advertisement
Guest User

Untitled

a guest
May 6th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.12 KB | None | 0 0
  1. package com.fortech.officetime.ldap;
  2.  
  3. import javax.faces.application.FacesMessage;
  4. import javax.faces.bean.ManagedBean;
  5. import javax.faces.bean.SessionScoped;
  6. import javax.faces.context.FacesContext;
  7. import javax.inject.Inject;
  8.  
  9. @ManagedBean
  10. @SessionScoped
  11. public class LoginBean {
  12.  
  13.     private String username;
  14.     private String password;
  15.  
  16.     @Inject
  17.     private ADService aDService;
  18.  
  19.     public LoginBean() {
  20.     }
  21.  
  22.     public String getUsername() {
  23.         return username;
  24.     }
  25.  
  26.     public void setUsername(String username) {
  27.         this.username = username;
  28.     }
  29.  
  30.     public String getPassword() {
  31.         return password;
  32.     }
  33.  
  34.     public void setPassword(String password) {
  35.         this.password = password;
  36.     }
  37.  
  38.     /* Method To Check User's Authentication Credentials */
  39.     public String validateLoginCredentials() {
  40.         String validationResult = "";
  41.         try {
  42.             validationResult = aDService.login(username, password);
  43.  
  44.         } catch (Exception exObj) {
  45.             validationResult = "login";
  46.             FacesContext.getCurrentInstance().addMessage("loginForm:loginName",
  47.                     new FacesMessage("Username Or Password Is Incorrect"));
  48.         }
  49.         return validationResult;
  50.     }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement