Skip to content
Snippets Groups Projects
Commit eaf95b40 authored by Falucho's avatar Falucho
Browse files

Fix Registro

parent b3b8e342
No related branches found
No related tags found
No related merge requests found
......@@ -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(
......
......@@ -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>
......
......@@ -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>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment