diff --git a/backoffice/src/main/java/uy/edu/fing/tse/jsf/UserLoginBean.java b/backoffice/src/main/java/uy/edu/fing/tse/jsf/UserLoginBean.java index 71843b9df1230dc589c17185ec2cb9874559119c..8dad390be35b30876d5d1347bb34cd85db1d0c4d 100644 --- a/backoffice/src/main/java/uy/edu/fing/tse/jsf/UserLoginBean.java +++ b/backoffice/src/main/java/uy/edu/fing/tse/jsf/UserLoginBean.java @@ -7,6 +7,8 @@ import uy.edu.fing.tse.dto.UserBO; import javax.ejb.EJB; import javax.enterprise.context.RequestScoped; +import javax.faces.application.FacesMessage; +import javax.faces.context.FacesContext; import javax.inject.Named; import java.io.Serializable; @@ -40,14 +42,25 @@ public class UserLoginBean implements Serializable { final var s = securityLocal.login(user); LOG.info(s); - - } - public void register() { + public String register() { final var s = securityLocal.register(user); + boolean valid = false; // verificar que sean iguales la pasw, en caso contrario + + if (valid) { + + return "gestionhechos"; + } else { + FacesContext.getCurrentInstance().addMessage( + null, + new FacesMessage(FacesMessage.SEVERITY_WARN, + " Usuario o Password diferentes", + "Por favor verificar los datos ingresados")); + return ""; + } } } diff --git a/backoffice/src/main/webapp/jsf/login.xhtml b/backoffice/src/main/webapp/jsf/login.xhtml index 5290cb9c3cdc2006160db54131f2406cd91e7492..83d6728d0ef61cacb59f65afddd9a2b092d992ed 100644 --- a/backoffice/src/main/webapp/jsf/login.xhtml +++ b/backoffice/src/main/webapp/jsf/login.xhtml @@ -23,6 +23,7 @@ <p:commandButton value="Register" action="register.xhmtl?faces-redirect=true" update="form" async="true" process="@this"/> <p:commandButton value="Login" action="#{userLoginView.login()}" update="form" /> </f:facet> + </h:panelGrid> </h:form> </ui:define> diff --git a/backoffice/src/main/webapp/jsf/register.xhtml b/backoffice/src/main/webapp/jsf/register.xhtml index d6a916e90264b1d4a6ca8e9d57f7e6592568532b..26d8cbe5eb6e0fcc9139ded9c80a169c8fc42a55 100644 --- a/backoffice/src/main/webapp/jsf/register.xhtml +++ b/backoffice/src/main/webapp/jsf/register.xhtml @@ -11,23 +11,25 @@ <ui:define name="contenido"> <h:form> <h1>Register</h1> - <h:panelGrid columns="3" cellpadding="5" id="form"> + <h:panelGrid columns="2" cellpadding="5" id="form"> <h:outputLabel for="username" value="Username:"/> <p:inputText id="username" value="#{userLoginView.user.mail}" required="true" requiredMessage="Ingrese su e-mail" label="username"/> - <p:message id="msgName" for="username"/> + <h:outputLabel for="password" value="Password:"/> <p:password id="password" value="#{userLoginView.user.password}" required="true" requiredMessage="Ingrese su password" label="password"/> - <p:message id="msgPassword" for="password"/> + <h:outputLabel for="repassword" value="RePassword:"/> <p:password id="repassword" value="#{userLoginView.repassword}" required="true" requiredMessage="Reingrese su password" label="repassword"/> - <p:message id="msgrepassword" for="repassword"/> <f:facet name="footer"> - <p:commandButton value="Register" action="#{userLoginView.register()}" update="form"/> - <p:commandButton value="Volver" action="login.xhmtl?faces-redirect=true" update="form" async="true" process="@this"/> + + <h:commandButton styleClass="btn btn-primary" vaction="#{userLoginView.regiszter}" value="Register" style="font-size:20px"/> + + <h:commandButton styleClass="btn btn-primary" value="Volver" action="login.xhmtl?faces-redirect=true" update="form" async="true" process="@this" style="font-size:20px"/> + </f:facet> </h:panelGrid>