Corrección de error en el alta de usuarios y formato de la pantalla de
login de usuarios.
This commit is contained in:
@@ -26,8 +26,7 @@ public class AuthorizationFilter implements Filter {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
|
||||
throws IOException, ServletException {
|
||||
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
|
||||
try {
|
||||
|
||||
HttpServletRequest reqt = (HttpServletRequest) request;
|
||||
@@ -35,8 +34,9 @@ public class AuthorizationFilter implements Filter {
|
||||
HttpSession ses = reqt.getSession(false);
|
||||
|
||||
String reqURI = reqt.getRequestURI();
|
||||
if (reqURI.indexOf("/login.xhtml") >= 0 || reqURI.indexOf("/RegisterUser.xhtml") >= 0 || (ses != null && ses.getAttribute("username") != null)
|
||||
|| reqURI.indexOf("/public/") >= 0 || reqURI.indexOf("/home.xhtml") >= 0 || reqURI.contains("javax.faces.resource"))
|
||||
if (reqURI.indexOf("/login.xhtml") >= 0 || reqURI.indexOf("/RegisterUser.xhtml") >= 0 || reqURI.indexOf("/RegisterUserResult.xhtml") >= 0
|
||||
|| (ses != null && ses.getAttribute("username") != null) || reqURI.indexOf("/public/") >= 0 || reqURI.indexOf("/home.xhtml") >= 0
|
||||
|| reqURI.contains("javax.faces.resource"))
|
||||
chain.doFilter(request, response);
|
||||
else
|
||||
resp.sendRedirect(reqt.getContextPath() + "/login.xhtml");
|
||||
|
||||
@@ -184,15 +184,15 @@ public class RegisterUserMBean extends ProfileMBeanBase implements Serializable
|
||||
this.nif = nif;
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public void addNewUser() {
|
||||
public String addNewUser() {
|
||||
int error = 0;
|
||||
|
||||
if (this.isFamilyDoctor() && this.primaryHealthCareCenter == null) {
|
||||
@@ -213,28 +213,33 @@ public class RegisterUserMBean extends ProfileMBeanBase implements Serializable
|
||||
switch (UserType.valueOf(this.userType)) {
|
||||
case PATIENT:
|
||||
PatientTO pat = this.remoteManager.registerPatient(id, nif, name, surname, password, email);
|
||||
this.id = pat.getId();
|
||||
|
||||
break;
|
||||
case FAMILY_DOCTOR:
|
||||
FamilyDoctorTO fd = this.remoteManager.registerFamilyDoctor1(id, nif, name, surname, password, email, this.primaryHealthCareCenter);
|
||||
this.id = fd.getId();
|
||||
|
||||
break;
|
||||
case SPECIALIST_DOCTOR:
|
||||
SpecialistDoctorTO sd = this.remoteManager.registerSpecialistDoctor(id, nif, name, surname, password, email, this.medicalSpecialty);
|
||||
this.id = sd.getId();
|
||||
|
||||
break;
|
||||
case ADMINISTRADOR:
|
||||
throw new NotSupportedException("No se soporta el registro directo de administradores.");
|
||||
}
|
||||
|
||||
this.addFacesMessage(FacesMessage.SEVERITY_INFO, "Alta realizada",
|
||||
this.addFacesMessage(FacesMessage.SEVERITY_INFO, "Registro realizado",
|
||||
"El usuario " + name + " " + surname + " se ha registrado correctamente. Por favor, comprueba su correo electrónico para verificar su cuenta.");
|
||||
|
||||
return "RegisterUserResult";
|
||||
} catch (Exception e) {
|
||||
this.manageException(e);
|
||||
}
|
||||
}
|
||||
|
||||
// FacesContext.getCurrentInstance().addMessage(null, msg);
|
||||
return "";
|
||||
}
|
||||
|
||||
public String getPasswordRepeat() {
|
||||
|
||||
Reference in New Issue
Block a user