Cambios en managedBeans (Herencia común) para gestionar EJBRemote

connection.
* Vistas para componente profile
* Inclusión de Primefaces
This commit is contained in:
mgarcianun
2019-11-22 18:15:09 +01:00
parent 8005e25d30
commit 6506eaed81
26 changed files with 337 additions and 50 deletions

View File

@@ -0,0 +1,69 @@
package managedbean.systemAdmin;
import java.io.Serializable;
import javax.faces.application.FacesMessage;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.faces.context.FacesContext;
import javax.servlet.http.HttpSession;
import common.SessionUtils;
@SuppressWarnings("deprecation")
@ManagedBean(name = "login")
@SessionScoped
public class LoginMBean implements Serializable {
private static final long serialVersionUID = 1094801825228386363L;
private String Password;
private String msg;
private String userName;
public String getPassword() {
return Password;
}
public void setPassword(String pwd) {
this.Password = pwd;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public String getUserName() {
return userName;
}
public void setUserName(String user) {
this.userName = user;
}
// validate login
public String validateUsernamePassword() {
// TODO: Validar login
boolean valid = this.userName.startsWith("a");
if (valid) {
HttpSession session = SessionUtils.getSession();
session.setAttribute("username", userName);
return "home";
} else {
FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_WARN,
"Usuario o contraseña incorrecta", "Por favor, intentalo de nuevo"));
return "login";
}
}
// logout event, invalidate session
public String logout() {
HttpSession session = SessionUtils.getSession();
session.invalidate();
return "home";
}
}