mirror of
https://github.com/simple-login/app.git
synced 2024-09-28 20:51: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">
|
||||
<label class="form-label">Email address</label>
|
||||
{{ form.email(class="form-control", type="email",
|
||||
placeholder="The email address associated with your SimpleLogin account") }}
|
||||
{{ form.email(class="form-control", type="email") }}
|
||||
{{ render_field_errors(form.email) }}
|
||||
</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 wtforms import StringField, validators
|
||||
|
||||
@ -17,13 +17,14 @@ def forgot_password():
|
||||
|
||||
if form.validate_on_submit():
|
||||
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)
|
||||
|
||||
if not user:
|
||||
error = "No such user, are you sure the email is correct?"
|
||||
return render_template("auth/forgot_password.html", form=form, error=error)
|
||||
|
||||
if user:
|
||||
send_reset_password_email(user)
|
||||
return redirect(url_for("auth.forgot_password"))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user