Corrección de error en el alta de usuarios y formato de la pantalla de
login de usuarios.
This commit is contained in:
@@ -11,6 +11,10 @@
|
|||||||
<from-outcome>RegisterUser</from-outcome>
|
<from-outcome>RegisterUser</from-outcome>
|
||||||
<to-view-id>/profile/RegisterUser.xhtml</to-view-id>
|
<to-view-id>/profile/RegisterUser.xhtml</to-view-id>
|
||||||
</navigation-case>
|
</navigation-case>
|
||||||
|
<navigation-case>
|
||||||
|
<from-outcome>RegisterUserResult</from-outcome>
|
||||||
|
<to-view-id>/profile/RegisterUserResult.xhtml</to-view-id>
|
||||||
|
</navigation-case>
|
||||||
<navigation-case>
|
<navigation-case>
|
||||||
<from-outcome>AddPatient</from-outcome>
|
<from-outcome>AddPatient</from-outcome>
|
||||||
<to-view-id>/profile/AddPatient.xhtml</to-view-id>
|
<to-view-id>/profile/AddPatient.xhtml</to-view-id>
|
||||||
|
|||||||
@@ -1,25 +1,34 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
|
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html">
|
||||||
xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html">
|
|
||||||
|
|
||||||
<ui:composition template="./header.xhtml">
|
<ui:composition template="./header.xhtml">
|
||||||
<ui:define name="content">
|
<ui:define name="content">
|
||||||
<h:form id="errorForm">
|
<h:form id="errorForm">
|
||||||
<div align="center">
|
<div align="center">
|
||||||
<h1>Se ha producido un error</h1>
|
<h1>Se ha producido un error</h1>
|
||||||
<hr/>
|
<hr />
|
||||||
<div>Descripcion del error:</div>
|
<div>Descripcion del error:</div>
|
||||||
<div>
|
<div>
|
||||||
<h:messages fatalClass="ErrorMessage" showDetail="true" showSummary="true" globalOnly="true">
|
<h:messages fatalClass="ErrorMessage" showDetail="true" showSummary="true" globalOnly="true" />
|
||||||
</h:messages>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<p align="center">
|
<div class="ui-g-12 ui-g-nopad">
|
||||||
<h:button value="Volver al inicio" outcome="home?refresh=1" />
|
<div class="ui-g-4 ui-md-5"></div>
|
||||||
</p>
|
<div class="ui-g-2 ui-md-2">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-4 ui-md-5"></div>
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-12 ui-g-nopad">
|
||||||
|
<div class="ui-g-4 ui-md-5"></div>
|
||||||
|
<div class="ui-g-2 ui-md-2">
|
||||||
|
<p:button value="Ir a la página principal" outcome="home" icon="pi pi-home" />
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-4 ui-md-5"></div>
|
||||||
|
</div>
|
||||||
</h:form>
|
</h:form>
|
||||||
</ui:define>
|
</ui:define>
|
||||||
</ui:composition>
|
</ui:composition>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -46,19 +46,25 @@
|
|||||||
|
|
||||||
<h:form id="frmLogin">
|
<h:form id="frmLogin">
|
||||||
|
|
||||||
<p:dialog header="Acceder al sistema" widgetVar="dlgLogin" resizable="false" modal="true" closeOnEscape="true">
|
<p:dialog header="Acceder al sistema" width="350px" widgetVar="dlgLogin" resizable="false" modal="true" closeOnEscape="true">
|
||||||
<h:panelGrid columns="2" cellpadding="5">
|
<div class="ui-g ui-fluid">
|
||||||
<h:outputLabel for="username" value="Username:" />
|
<div class="ui-g-12">
|
||||||
|
<h:outputLabel for="username" value="Usuario:" />
|
||||||
<p:inputText id="username" value="#{loginView.username}" />
|
<p:inputText id="username" value="#{loginView.username}" />
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-12">
|
||||||
|
|
||||||
<h:outputLabel for="password" value="Password:" />
|
<h:outputLabel for="password" value="Contraseña:" />
|
||||||
<p:password id="password" value="#{loginView.password}" />
|
<p:password id="password" value="#{loginView.password}" />
|
||||||
|
</div>
|
||||||
<f:facet name="footer">
|
<div class="ui-g-6">
|
||||||
<p:commandButton value="Login" update="frmMenu, messages" icon="pi pi-sign-in" action="#{loginView.login}" onstart="startLogin()" oncomplete="handleLoginRequest(xhr, status, args)"/>
|
<p:commandButton value="Login" update="frmMenu, messages" icon="pi pi-sign-in" action="#{loginView.login}" onstart="startLogin()"
|
||||||
|
oncomplete="handleLoginRequest(xhr, status, args)" />
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-6">
|
||||||
<p:commandButton value="Cancel" icon="pi pi-ban" onclick="PF('dlgLogin').hide();" />
|
<p:commandButton value="Cancel" icon="pi pi-ban" onclick="PF('dlgLogin').hide();" />
|
||||||
</f:facet>
|
</div>
|
||||||
</h:panelGrid>
|
</div>
|
||||||
</p:dialog>
|
</p:dialog>
|
||||||
</h:form>
|
</h:form>
|
||||||
<h:form id="frmMenu">
|
<h:form id="frmMenu">
|
||||||
|
|||||||
@@ -23,23 +23,33 @@
|
|||||||
<ui:composition template="./header.xhtml">
|
<ui:composition template="./header.xhtml">
|
||||||
<ui:define name="content">
|
<ui:define name="content">
|
||||||
<h:form>
|
<h:form>
|
||||||
<h:outputLink value="javascript:void(0)" onclick="PF('dlg').show();" title="login">
|
<div class="ui-g ui-fluid">
|
||||||
<h:outputText>Login</h:outputText>
|
<div class="ui-g-4 ui-md-4" />
|
||||||
</h:outputLink>
|
<div class="ui-g-4 ui-md-4">
|
||||||
|
<p:panel id="LoginPanel" header="Acceder al sistema">
|
||||||
|
<div class="ui-g ui-fluid">
|
||||||
|
<div class="ui-g-12">
|
||||||
|
<h:outputLabel for="username" value="Usuario:" />
|
||||||
|
<p:inputText id="username" value="#{loginView.username}" />
|
||||||
|
</div>
|
||||||
|
|
||||||
<p:growl id="growl" sticky="true" showDetail="true" life="3000" />
|
<div class="ui-g-12">
|
||||||
|
<h:outputLabel for="password" value="Contraseña:" />
|
||||||
|
<p:password id="password" value="#{loginView.password}" />
|
||||||
|
</div>
|
||||||
|
|
||||||
<h:panelGrid columns="2" cellpadding="5">
|
<div class="ui-g-6">
|
||||||
<h:outputLabel for="username" value="Username:" />
|
<p:commandButton value="Login" update="frmMenu, messages" icon="pi pi-sign-in" action="#{loginView.login}" onstart="startLogin()"
|
||||||
<p:inputText id="username" value="#{loginView.username}" required="true" label="username" />
|
oncomplete="handleLoginRequest(xhr, status, args)" />
|
||||||
|
</div>
|
||||||
<h:outputLabel for="password" value="Password:" />
|
<div class="ui-g-6">
|
||||||
<p:password id="password" value="#{loginView.password}" required="true" label="password" />
|
<p:button value="Volver" outcome="home" icon="pi pi-home" />
|
||||||
|
</div>
|
||||||
<f:facet name="footer">
|
</div>
|
||||||
<p:commandButton value="Login" update="growl" action="#{loginView.login}" oncomplete="handleLoginRequest(xhr, status, args)" />
|
</p:panel>
|
||||||
</f:facet>
|
</div>
|
||||||
</h:panelGrid>
|
<div class="ui-g-4 ui-md-4" />
|
||||||
|
</div>
|
||||||
</h:form>
|
</h:form>
|
||||||
</ui:define>
|
</ui:define>
|
||||||
</ui:composition>
|
</ui:composition>
|
||||||
|
|||||||
44
1.sources/MyHealth/docroot/profile/RegisterUserResult.xhtml
Normal file
44
1.sources/MyHealth/docroot/profile/RegisterUserResult.xhtml
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html"
|
||||||
|
xmlns:p="http://primefaces.org/ui">
|
||||||
|
|
||||||
|
<ui:composition template="../header.xhtml">
|
||||||
|
<ui:define name="content">
|
||||||
|
<h:form id="frmRegisterUserResult">
|
||||||
|
<div class="ui-g-4 ui-md-4" />
|
||||||
|
<div class="ui-g-4 ui-md-4">
|
||||||
|
|
||||||
|
<p:panel id="DatosPersonales" header="El registro se ha realizado correctamente">
|
||||||
|
<div class="ui-g ui-fluid">
|
||||||
|
|
||||||
|
<div class="ui-g-12">
|
||||||
|
Se ha registrado correctamente, el sistema le ha asignado un <b> <p:outputLabel value="Código de Identificación Personal (CIP)" rendered="#{registerUser.patient}" /> <p:outputLabel
|
||||||
|
value="Número de Profesional" rendered="#{registerUser.familyDoctor or registerUser.specialistDoctor}" />
|
||||||
|
</b> , por favor recuerdelo ya que deberá utilizarlo para logearse en el sistema.
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="ui-g-12">
|
||||||
|
<p:outputLabel value="Su Código de Identificación Personal (CIP) es" rendered="#{registerUser.patient}" />
|
||||||
|
<p:outputLabel value="Número de Profesional es" rendered="#{registerUser.familyDoctor or registerUser.specialistDoctor}" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="ui-g-12" style="font-size: larger;font-weight: bold; text-align:center;">
|
||||||
|
<p:outputLabel value="#{registerUser.id}" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="ui-g-2"></div>
|
||||||
|
<div class="ui-g-8">
|
||||||
|
<p:button value="Ir a la página principal" outcome="home" icon="pi pi-home" />
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-2"></div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</p:panel>
|
||||||
|
</div>
|
||||||
|
<div class="ui-g-4 ui-md-4" />
|
||||||
|
</h:form>
|
||||||
|
</ui:define>
|
||||||
|
</ui:composition>
|
||||||
|
</html>
|
||||||
@@ -30,7 +30,8 @@
|
|||||||
<p:outputLabel value="Tipo de usuario:" for="selUsertype" />
|
<p:outputLabel value="Tipo de usuario:" for="selUsertype" />
|
||||||
</div>
|
</div>
|
||||||
<div class="ui-g-6 ui-md-6">
|
<div class="ui-g-6 ui-md-6">
|
||||||
<p:selectOneButton id="selUsertype" value="#{registerUser.userType}" disabled="true" required="true" unselectable="false" requiredMessage="Debe especificar un tipo de usuario">
|
<p:selectOneButton id="selUsertype" value="#{registerUser.userType}" disabled="true" required="true" unselectable="false"
|
||||||
|
requiredMessage="Debe especificar un tipo de usuario">
|
||||||
<f:selectItems value="#{registerUser.userTypes}" var="item" itemLabel="#{item.userTypename}" itemValue="#{item.name}" />
|
<f:selectItems value="#{registerUser.userTypes}" var="item" itemLabel="#{item.userTypename}" itemValue="#{item.name}" />
|
||||||
</p:selectOneButton>
|
</p:selectOneButton>
|
||||||
</div>
|
</div>
|
||||||
@@ -116,7 +117,8 @@
|
|||||||
<p:outputLabel value="Centro:" for="selPHC" />
|
<p:outputLabel value="Centro:" for="selPHC" />
|
||||||
</div>
|
</div>
|
||||||
<div class="ui-g-4 ui-md-4">
|
<div class="ui-g-4 ui-md-4">
|
||||||
<p:selectOneMenu id="selPHC" value="#{registerUser.primaryHealthCareCenter}" converter="omnifaces.SelectItemsConverter" required="#{registerUser.familyDoctor}" requiredMessage="Por favor, selecciona un centro de antención primaria">
|
<p:selectOneMenu id="selPHC" value="#{registerUser.primaryHealthCareCenter}" converter="omnifaces.SelectItemsConverter" required="#{registerUser.familyDoctor}"
|
||||||
|
requiredMessage="Por favor, selecciona un centro de antención primaria">
|
||||||
<f:selectItem itemLabel="Seleccione un centro de antención primario..." itemValue="" noSelectionOption="true" />
|
<f:selectItem itemLabel="Seleccione un centro de antención primario..." itemValue="" noSelectionOption="true" />
|
||||||
<f:selectItems value="#{registerUser.phcList}" var="phc" itemLabel="#{phc.location}" itemValue="#{phc}" />
|
<f:selectItems value="#{registerUser.phcList}" var="phc" itemLabel="#{phc.location}" itemValue="#{phc}" />
|
||||||
<p:column>#{phc.name}</p:column>
|
<p:column>#{phc.name}</p:column>
|
||||||
@@ -133,7 +135,8 @@
|
|||||||
<p:outputLabel value="Especialidad médica:" for="selMS" />
|
<p:outputLabel value="Especialidad médica:" for="selMS" />
|
||||||
</div>
|
</div>
|
||||||
<div class="ui-g-4 ui-md-4">
|
<div class="ui-g-4 ui-md-4">
|
||||||
<p:selectOneMenu id="selMS" value="#{registerUser.medicalSpecialty}" converter="omnifaces.SelectItemsConverter" required="#{registerUser.specialistDoctor}" requiredMessage="Por favor, seleccione una especialidad médica" >
|
<p:selectOneMenu id="selMS" value="#{registerUser.medicalSpecialty}" converter="omnifaces.SelectItemsConverter" required="#{registerUser.specialistDoctor}"
|
||||||
|
requiredMessage="Por favor, seleccione una especialidad médica">
|
||||||
<f:selectItem itemLabel="Seleccione una especialidad médica..." itemValue="" noSelectionOption="true" />
|
<f:selectItem itemLabel="Seleccione una especialidad médica..." itemValue="" noSelectionOption="true" />
|
||||||
<f:selectItems value="#{registerUser.medicalSpecialtiesList}" var="ms" itemLabel="#{ms.description}" itemValue="#{ms}" />
|
<f:selectItems value="#{registerUser.medicalSpecialtiesList}" var="ms" itemLabel="#{ms.description}" itemValue="#{ms}" />
|
||||||
<p:column>#{ms.name}</p:column>
|
<p:column>#{ms.name}</p:column>
|
||||||
|
|||||||
@@ -46,7 +46,10 @@ public class ProfileFacadeBean implements ProfileFacadeRemote {
|
|||||||
public PatientTO registerPatient(Integer id, String nif, String name, String surname, String password, String email) {
|
public PatientTO registerPatient(Integer id, String nif, String name, String surname, String password, String email) {
|
||||||
PatientTO paTO = null;
|
PatientTO paTO = null;
|
||||||
|
|
||||||
PatientJPA ms = new PatientJPA(id, nif, name, surname, HashUtils.hashMD5(password), email);
|
if (id == null)
|
||||||
|
id = 1;
|
||||||
|
|
||||||
|
PatientJPA ms = new PatientJPA(nif, name, surname, HashUtils.hashMD5(password), email);
|
||||||
entman.persist(ms);
|
entman.persist(ms);
|
||||||
paTO = new PatientTO(ms.getId(), ms.getNif(), ms.getName(), ms.getSurname(), ms.getPassword(), ms.getEmail());
|
paTO = new PatientTO(ms.getId(), ms.getNif(), ms.getName(), ms.getSurname(), ms.getPassword(), ms.getEmail());
|
||||||
|
|
||||||
@@ -60,8 +63,9 @@ public class ProfileFacadeBean implements ProfileFacadeRemote {
|
|||||||
|
|
||||||
// TODO: Lanzar error si no se encuentra la especialidad.
|
// TODO: Lanzar error si no se encuentra la especialidad.
|
||||||
if (ms != null) {
|
if (ms != null) {
|
||||||
SpecialistDoctorJPA sd = new SpecialistDoctorJPA(id, nif, name, surname, HashUtils.hashMD5(password), email);
|
SpecialistDoctorJPA sd = new SpecialistDoctorJPA(nif, name, surname, HashUtils.hashMD5(password), email, ms);
|
||||||
entman.persist(sd);
|
entman.persist(sd);
|
||||||
|
|
||||||
sdTO = new SpecialistDoctorTO(sd.getId(), sd.getNif(), sd.getName(), sd.getSurname(), sd.getPassword(), sd.getEmail());
|
sdTO = new SpecialistDoctorTO(sd.getId(), sd.getNif(), sd.getName(), sd.getSurname(), sd.getPassword(), sd.getEmail());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -76,9 +80,7 @@ public class ProfileFacadeBean implements ProfileFacadeRemote {
|
|||||||
// TODO: Lanzar error si no encontramos el cap!!!!!
|
// TODO: Lanzar error si no encontramos el cap!!!!!
|
||||||
if (phcC != null) {
|
if (phcC != null) {
|
||||||
|
|
||||||
FamilyDoctorJPA fd = new FamilyDoctorJPA(id, nif, name, surname, HashUtils.hashMD5(password), email);
|
FamilyDoctorJPA fd = new FamilyDoctorJPA(nif, name, surname, HashUtils.hashMD5(password), email, phcC);
|
||||||
fd.setPrimaryHealthCareCenter(phcC);
|
|
||||||
|
|
||||||
entman.persist(fd);
|
entman.persist(fd);
|
||||||
|
|
||||||
fdTO = new FamilyDoctorTO(fd.getId(), fd.getNif(), fd.getName(), fd.getSurname(), fd.getPassword(), fd.getEmail());
|
fdTO = new FamilyDoctorTO(fd.getId(), fd.getNif(), fd.getName(), fd.getSurname(), fd.getPassword(), fd.getEmail());
|
||||||
|
|||||||
@@ -4,9 +4,9 @@ import java.util.Collection;
|
|||||||
|
|
||||||
import javax.ejb.Remote;
|
import javax.ejb.Remote;
|
||||||
|
|
||||||
|
import TO.LoggedUserTO;
|
||||||
import TO.MedicalSpecialtyTO;
|
import TO.MedicalSpecialtyTO;
|
||||||
import TO.PrimaryHealthCareCenterTO;
|
import TO.PrimaryHealthCareCenterTO;
|
||||||
import TO.LoggedUserTO;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -42,13 +42,13 @@ public class FamilyDoctorJPA implements Serializable {
|
|||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
public FamilyDoctorJPA(int id, String nif, String name, String surname, String password, String email) {
|
public FamilyDoctorJPA(String nif, String name, String surname, String password, String email, PrimaryHealthCareCenterJPA phc) {
|
||||||
this.id = id;
|
|
||||||
this.nif = nif;
|
this.nif = nif;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.surname = surname;
|
this.surname = surname;
|
||||||
this.password = password;
|
this.password = password;
|
||||||
this.email = email;
|
this.email = email;
|
||||||
|
this.primaryHealthCareCenter = phc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
|
|||||||
@@ -40,8 +40,7 @@ public class PatientJPA implements Serializable {
|
|||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
public PatientJPA(int id, String nif, String name, String surname, String password, String email) {
|
public PatientJPA(String nif, String name, String surname, String password, String email) {
|
||||||
this.id = id;
|
|
||||||
this.nif = nif;
|
this.nif = nif;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.surname = surname;
|
this.surname = surname;
|
||||||
|
|||||||
@@ -37,13 +37,13 @@ public class SpecialistDoctorJPA implements Serializable {
|
|||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
public SpecialistDoctorJPA(Integer id, String nif, String name, String surname, String password, String email) {
|
public SpecialistDoctorJPA(String nif, String name, String surname, String password, String email, MedicalSpecialtyJPA ms) {
|
||||||
this.id = id;
|
|
||||||
this.nif = nif;
|
this.nif = nif;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.surname = surname;
|
this.surname = surname;
|
||||||
this.password = password;
|
this.password = password;
|
||||||
this.email = email;
|
this.email = email;
|
||||||
|
this.medicalSpecialty = ms;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Id
|
@Id
|
||||||
|
|||||||
@@ -26,8 +26,7 @@ public class AuthorizationFilter implements Filter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
|
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
|
||||||
throws IOException, ServletException {
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
HttpServletRequest reqt = (HttpServletRequest) request;
|
HttpServletRequest reqt = (HttpServletRequest) request;
|
||||||
@@ -35,8 +34,9 @@ public class AuthorizationFilter implements Filter {
|
|||||||
HttpSession ses = reqt.getSession(false);
|
HttpSession ses = reqt.getSession(false);
|
||||||
|
|
||||||
String reqURI = reqt.getRequestURI();
|
String reqURI = reqt.getRequestURI();
|
||||||
if (reqURI.indexOf("/login.xhtml") >= 0 || reqURI.indexOf("/RegisterUser.xhtml") >= 0 || (ses != null && ses.getAttribute("username") != null)
|
if (reqURI.indexOf("/login.xhtml") >= 0 || reqURI.indexOf("/RegisterUser.xhtml") >= 0 || reqURI.indexOf("/RegisterUserResult.xhtml") >= 0
|
||||||
|| reqURI.indexOf("/public/") >= 0 || reqURI.indexOf("/home.xhtml") >= 0 || reqURI.contains("javax.faces.resource"))
|
|| (ses != null && ses.getAttribute("username") != null) || reqURI.indexOf("/public/") >= 0 || reqURI.indexOf("/home.xhtml") >= 0
|
||||||
|
|| reqURI.contains("javax.faces.resource"))
|
||||||
chain.doFilter(request, response);
|
chain.doFilter(request, response);
|
||||||
else
|
else
|
||||||
resp.sendRedirect(reqt.getContextPath() + "/login.xhtml");
|
resp.sendRedirect(reqt.getContextPath() + "/login.xhtml");
|
||||||
|
|||||||
@@ -184,15 +184,15 @@ public class RegisterUserMBean extends ProfileMBeanBase implements Serializable
|
|||||||
this.nif = nif;
|
this.nif = nif;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Integer getId() {
|
public int getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setId(Integer id) {
|
public void setId(int id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addNewUser() {
|
public String addNewUser() {
|
||||||
int error = 0;
|
int error = 0;
|
||||||
|
|
||||||
if (this.isFamilyDoctor() && this.primaryHealthCareCenter == null) {
|
if (this.isFamilyDoctor() && this.primaryHealthCareCenter == null) {
|
||||||
@@ -213,28 +213,33 @@ public class RegisterUserMBean extends ProfileMBeanBase implements Serializable
|
|||||||
switch (UserType.valueOf(this.userType)) {
|
switch (UserType.valueOf(this.userType)) {
|
||||||
case PATIENT:
|
case PATIENT:
|
||||||
PatientTO pat = this.remoteManager.registerPatient(id, nif, name, surname, password, email);
|
PatientTO pat = this.remoteManager.registerPatient(id, nif, name, surname, password, email);
|
||||||
|
this.id = pat.getId();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case FAMILY_DOCTOR:
|
case FAMILY_DOCTOR:
|
||||||
FamilyDoctorTO fd = this.remoteManager.registerFamilyDoctor1(id, nif, name, surname, password, email, this.primaryHealthCareCenter);
|
FamilyDoctorTO fd = this.remoteManager.registerFamilyDoctor1(id, nif, name, surname, password, email, this.primaryHealthCareCenter);
|
||||||
|
this.id = fd.getId();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case SPECIALIST_DOCTOR:
|
case SPECIALIST_DOCTOR:
|
||||||
SpecialistDoctorTO sd = this.remoteManager.registerSpecialistDoctor(id, nif, name, surname, password, email, this.medicalSpecialty);
|
SpecialistDoctorTO sd = this.remoteManager.registerSpecialistDoctor(id, nif, name, surname, password, email, this.medicalSpecialty);
|
||||||
|
this.id = sd.getId();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case ADMINISTRADOR:
|
case ADMINISTRADOR:
|
||||||
throw new NotSupportedException("No se soporta el registro directo de administradores.");
|
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.");
|
"El usuario " + name + " " + surname + " se ha registrado correctamente. Por favor, comprueba su correo electrónico para verificar su cuenta.");
|
||||||
|
|
||||||
|
return "RegisterUserResult";
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
this.manageException(e);
|
this.manageException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// FacesContext.getCurrentInstance().addMessage(null, msg);
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPasswordRepeat() {
|
public String getPasswordRepeat() {
|
||||||
|
|||||||
Reference in New Issue
Block a user