// login method .. open the page depend in user if admin or not
public String Login() {
for(Employees emp1 : Employees.theAllEmp) {
if(emp1.getEmail().equals(emp.getEmail()))
{
if(emp1.getPassword().equals(emp.getPassword()))
{
if (emp1.getAdmin() == 0) {
return "adminView.xhtml?faces-redirect=true";
} else if (emp1.getAdmin() == 1) {
return "employeesView.xhtml?faces-redirect=true";
} else {
FacesContext.getCurrentInstance().addMessage(null,
new FacesMessage(FacesMessage.SEVERITY_ERROR, "No such Email", "No such Email"));
return null;
}
}
}
}
return null;
}
Aucun commentaire:
Enregistrer un commentaire