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 0e01fa1eeacc5545ca37bd58988aa79e3908e8e8..fb192031d8e38b30a47e0c3e29a79b92dcb0f5d4 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 @@ -37,6 +37,7 @@ public class UserLoginBean implements Serializable { } final UserBO user = new UserBO(); + private String repassword; public List<Role> getRoles() { @@ -59,7 +60,6 @@ public class UserLoginBean implements Serializable { this.repassword = repassword; } - public void login() { final var s = securityLocal.login(user); @@ -68,11 +68,14 @@ public class UserLoginBean implements Serializable { public String register() { - final var s = securityLocal.register(user); - boolean valid = false; // verificar que sean iguales la pasw, en caso contrario + boolean valid = true; + // verificar que sean iguales la pasw, en caso contrario + valid &= user.getPassword().equals(repassword); + //Verificar que no existe usuario + //TODO if (valid) { - + final var s = securityLocal.register(user); return "gestionhechos"; } else { FacesContext.getCurrentInstance().addMessage( diff --git a/backoffice/src/main/webapp/jsf/login.xhtml b/backoffice/src/main/webapp/jsf/login.xhtml index 83d6728d0ef61cacb59f65afddd9a2b092d992ed..ff78a6ad5ffc56e7f6d1d0b16aca7b2e5edc29a1 100644 --- a/backoffice/src/main/webapp/jsf/login.xhtml +++ b/backoffice/src/main/webapp/jsf/login.xhtml @@ -20,8 +20,9 @@ <p:password id="password" value="#{userLoginView.user.password}" required="true" requiredMessage="Ingrese: su password" label="password"/> <p:message id="msgPassword" for="password"/> <f:facet name="footer"> - <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" /> + <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> diff --git a/backoffice/src/main/webapp/jsf/register.xhtml b/backoffice/src/main/webapp/jsf/register.xhtml index 0c8489751ca4411238e150064742f4a776dc6ffa..0cc5d4a2686eb55efaa963f165fa771a1788d227 100644 --- a/backoffice/src/main/webapp/jsf/register.xhtml +++ b/backoffice/src/main/webapp/jsf/register.xhtml @@ -29,20 +29,19 @@ <p:outputLabel for="rol" value="Rol:"/> - <p:selectOneRadio id="rol" value="#{userLoginView.user.role}" unselectable="false"> - <f:selectItems value="#{userLoginView.roles}" var="r" itemLabel="#{r.name}" itemValue="#{r}"/> + <p:selectOneRadio id="rol" value="#{userLoginView.user.role.name}" unselectable="false"> + <f:selectItems value="#{userLoginView.roles}" var="r" itemLabel="#{r.name}" itemValue="#{r.name}"/> </p:selectOneRadio> <f:facet name="footer"> - - <h:commandButton styleClass="btn btn-primary" vaction="#{userLoginView.register}" value="Register" - style="font-size:20px"/> + <h:commandButton styleClass="btn btn-primary" action="#{userLoginView.register()}" + value="Crear Usuario" style="font-size:20px"/> <h:commandButton styleClass="btn btn-primary" value="Volver" - action="login.xhmtl?faces-redirect=true" update="form" async="true" process="@this" + action="login.xhmtl?faces-redirect=true" + update="form" async="true" process="@this" style="font-size:20px"/> - </f:facet> </h:panelGrid>