lundi 21 janvier 2019

Is there is any other solution to login method with multiple users?

I am creating a website with multiple users , here is the code i created but it does not work , what is the correct ?

This is a java Project, Java se

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