fix password recovery unknown email
This commit is contained in:
parent
c63f49e491
commit
df46bfcaed
|
@ -93,10 +93,14 @@ object Auth extends LilaController {
|
|||
implicit val req = ctx.body
|
||||
forms.passwordReset.bindFromRequest.fold(
|
||||
err => forms.anyCaptcha map { captcha =>
|
||||
BadRequest(html.auth.passwordReset(err, captcha))
|
||||
BadRequest(html.auth.passwordReset(err, captcha, false.some))
|
||||
},
|
||||
data => UserRepo enabledByEmail data.email flatten s"No such user: ${data.email}" flatMap { user =>
|
||||
Env.security.passwordReset.send(user, data.email) inject Redirect(routes.Auth.passwordResetSent(data.email))
|
||||
data => UserRepo enabledByEmail data.email flatMap {
|
||||
case Some(user) =>
|
||||
Env.security.passwordReset.send(user, data.email) inject Redirect(routes.Auth.passwordResetSent(data.email))
|
||||
case None => forms.passwordResetWithCaptcha map {
|
||||
case (form, captcha) => BadRequest(html.auth.passwordReset(form, captcha, false.some))
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
|
|
@ -1,11 +1,17 @@
|
|||
@(form: Form[_], captcha: lila.common.Captcha)(implicit ctx: Context)
|
||||
@(form: Form[_], captcha: lila.common.Captcha, ok: Option[Boolean] = None)(implicit ctx: Context)
|
||||
|
||||
@auth.layout(
|
||||
title = trans.passwordReset.str(),
|
||||
zen = true) {
|
||||
<div class="content_box small_box signup">
|
||||
<div class="signup_box">
|
||||
<h1 class="lichess_title">@trans.passwordReset()</h1>
|
||||
<h1 class="lichess_title">
|
||||
@ok.map {
|
||||
case true => {<span class="is-green" data-icon="E"></span>}
|
||||
case false => {<span class="is-red" data-icon="L"></span>}
|
||||
}
|
||||
@trans.passwordReset()
|
||||
</h1>
|
||||
<form action="@routes.Auth.passwordResetApply" method="POST">
|
||||
<ul>
|
||||
<li class="email">
|
||||
|
|
Loading…
Reference in a new issue