mirror of
https://github.com/spiral-project/ihatemoney.git
synced 2025-05-01 02:32:23 +02:00
fix: display validation message on password reminder
Create a new route with a new generic page that display a title and a message on a <p> tag. This route will be triggered after succesfully submit password reminder form See issue #455
This commit is contained in:
parent
33d497aac2
commit
db98010691
2 changed files with 15 additions and 2 deletions
8
ihatemoney/templates/display_message.html
Normal file
8
ihatemoney/templates/display_message.html
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
{% extends "layout.html" %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<h2>{{ _(title) }}</h2>
|
||||||
|
<p>
|
||||||
|
{{message}}
|
||||||
|
</p>
|
||||||
|
{% endblock %}
|
|
@ -271,18 +271,23 @@ def remind_password():
|
||||||
if form.validate():
|
if form.validate():
|
||||||
# get the project
|
# get the project
|
||||||
project = Project.query.get(form.id.data)
|
project = Project.query.get(form.id.data)
|
||||||
|
|
||||||
# send a link to reset the password
|
# send a link to reset the password
|
||||||
password_reminder = "password_reminder.%s.j2" % get_locale().language
|
password_reminder = "password_reminder.%s.j2" % get_locale().language
|
||||||
current_app.mail.send(Message(
|
current_app.mail.send(Message(
|
||||||
"password recovery",
|
"password recovery",
|
||||||
body=render_template(password_reminder, project=project),
|
body=render_template(password_reminder, project=project),
|
||||||
recipients=[project.contact_email]))
|
recipients=[project.contact_email]))
|
||||||
flash(_("A link to reset your password has been sent to your email."))
|
return redirect(url_for(".password_reminder_sent"))
|
||||||
|
|
||||||
return render_template("password_reminder.html", form=form)
|
return render_template("password_reminder.html", form=form)
|
||||||
|
|
||||||
|
|
||||||
|
@main.route("/password-reminder-sent", methods=["GET"])
|
||||||
|
def password_reminder_sent():
|
||||||
|
message = "A link to reset your password has been sent to you, please check your emails"
|
||||||
|
return render_template("display_message.html", title="Password reminder", message=message)
|
||||||
|
|
||||||
|
|
||||||
@main.route('/reset-password', methods=['GET', 'POST'])
|
@main.route('/reset-password', methods=['GET', 'POST'])
|
||||||
def reset_password():
|
def reset_password():
|
||||||
form = ResetPasswordForm()
|
form = ResetPasswordForm()
|
||||||
|
|
Loading…
Reference in a new issue