mirror of
https://github.com/simple-login/app.git
synced 2024-09-29 21:21:29 +02:00
do not return error when user doesn't exist on forgot_password
This commit is contained in:
parent
26a094469b
commit
a069fe7b6a
@ -16,8 +16,7 @@
|
|||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="form-label">Email address</label>
|
<label class="form-label">Email address</label>
|
||||||
{{ form.email(class="form-control", type="email",
|
{{ form.email(class="form-control", type="email") }}
|
||||||
placeholder="The email address associated with your SimpleLogin account") }}
|
|
||||||
{{ render_field_errors(form.email) }}
|
{{ render_field_errors(form.email) }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
from flask import request, render_template, redirect, url_for
|
from flask import request, render_template, redirect, url_for, flash
|
||||||
from flask_wtf import FlaskForm
|
from flask_wtf import FlaskForm
|
||||||
from wtforms import StringField, validators
|
from wtforms import StringField, validators
|
||||||
|
|
||||||
@ -17,13 +17,14 @@ def forgot_password():
|
|||||||
|
|
||||||
if form.validate_on_submit():
|
if form.validate_on_submit():
|
||||||
email = form.email.data.strip().lower()
|
email = form.email.data.strip().lower()
|
||||||
|
flash(
|
||||||
|
"If your email is correct, you are going to receive an email to reset your password",
|
||||||
|
"success",
|
||||||
|
)
|
||||||
|
|
||||||
user = User.get_by(email=email)
|
user = User.get_by(email=email)
|
||||||
|
|
||||||
if not user:
|
if user:
|
||||||
error = "No such user, are you sure the email is correct?"
|
|
||||||
return render_template("auth/forgot_password.html", form=form, error=error)
|
|
||||||
|
|
||||||
send_reset_password_email(user)
|
send_reset_password_email(user)
|
||||||
return redirect(url_for("auth.forgot_password"))
|
return redirect(url_for("auth.forgot_password"))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user