From 75209aeed0140c804047b4f3466d329b9eb246b9 Mon Sep 17 00:00:00 2001 From: Alexis Metaireau Date: Sat, 8 Oct 2011 15:52:12 +0200 Subject: Add a password recovery feature. Fix #32 --- budget/web.py | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'budget/web.py') diff --git a/budget/web.py b/budget/web.py index 28740fc..8b251a1 100644 --- a/budget/web.py +++ b/budget/web.py @@ -6,8 +6,7 @@ import werkzeug # local modules from models import db, Project, Person, Bill -from forms import (get_billform_for, ProjectForm, AuthenticationForm, BillForm, - MemberForm, InviteForm, CreateArchiveForm, EditProjectForm) +from forms import * from utils import Redirect303 """ @@ -149,6 +148,23 @@ def create_project(): return render_template("create_project.html", form=form) +@main.route("/password-reminder", methods=["GET", "POST"]) +def remind_password(): + form = PasswordReminder() + if request.method == "POST": + if form.validate(): + # get the project + project = Project.query.get(form.id.data) + + # send the password reminder + mail.send(Message("password recovery", + body=render_template("password_reminder", project=project), + recipients=[project.contact_email])) + flash("a mail has been sent to you with the password") + + return render_template("password_reminder.html", form=form) + + @main.route("//edit", methods=["GET", "POST"]) def edit_project(): form = EditProjectForm() -- cgit v1.1