Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 18 additions & 4 deletions src/main/scala/code/snippet/UserSnips.scala
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ object UserRegister extends ReCaptcha with SnippetHelper {
newUser.username(newUser.email.get)
if(validateCaptcha.isDefined){
// invalid captcha error message
S.error("captchaError", "Invalid captcha")
S.error("captchaError", "Error en el captcha. Vuelva a intentarlo")
reloadCaptcha
} else {
newUser.validate match {
Expand All @@ -292,12 +292,26 @@ object UserRegister extends ReCaptcha with SnippetHelper {
User.sendEmailConfirmation(newUser)
RedirectTo("/", () => S.notice("Un correo electronico ha sido enviado a su cuenta con instrucciones para acceder."))
} else {
S.error("register_err", "Las contraseñas no coinciden")
S.error("password_err", "Las contraseñas no coinciden")
Noop
}
case error: List[FieldError] =>
S.error(error)
Noop
error.foreach ( el => {
el match {
case email_id =>
S.error("email_err", email_id.msg)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

algo como S.error(el.id, el.msg) no funciona?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope. id does not exist in el. at least, the compiler gives me that error message.
Anyway, I am checking one by one because I want to write message below the corresponding field/s. Or do you prefer to show error messages into only one container?
After reviewing the fields name and lastName, It is not mandatory to use a name or lastName for registering users.. they can be empty. Is that ok?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

case name_id =>
S.error("name_err", name_id.msg)
case lastName_id =>
S.error("lastName_err", lastName_id.msg)
case _ =>
S.error("register_err", "Sorry. Something else went wrong")
}
})
if((pwd != repeatPwd) || pwd.trim.isEmpty) {
S.error("password_err", "Vuelva a reingresar su contraseña")
Noop
}
}
}
}
Expand Down
7 changes: 5 additions & 2 deletions src/main/webapp/register.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ <h4>Correo y contraseña</h4>
<label class="col-md-12 control-label ">Correo electrónico</label>
<div data-name="email" placeholder="Introduce tu email" type="email" />
</div>
<span data-alertid="email_err" form-alert=""></span>
<div class="form-group margin-bottom-xs">
<label class="col-md-12 control-label ">Contraseña</label>
<div class="col-md-12"><input class="form-control input-lg" data-name="password" placeholder="" type="password"></div>
Expand All @@ -46,9 +47,11 @@ <h4>Correo y contraseña</h4>
<label class="col-md-12 control-label ">Confirmar contraseña</label>
<div class="col-md-12"><input class="form-control input-lg" data-name="repeatPwd" placeholder="" type="password"></div>
</div>
<span data-alertid="password_err" form-alert=""></span>
</div>
<h4>Comprueba que no eres un robot</h4>
<span class="lift:Msg?id=captchaError&errorClass=error">error</span> <span id="captcha"></span>
<!--<span class="lift:Msg?id=captchaError&errorClass=error">error</span> <span id="captcha"></span>-->
<span data-alertid="captchaError" form-alert=""></span>
<div data-name="captcha"></div>
<span id="ajax-loader" style="display: none;">
<img src="/images/ajax-loader.gif" width="25" height="25" />
Expand All @@ -62,4 +65,4 @@ <h4>Comprueba que no eres un robot</h4>
</div>
</main>
</div>
</div>
</div>