aboutsummaryrefslogtreecommitdiff
path: root/budget/web.py
diff options
context:
space:
mode:
authorAlexis Metaireau <alexis@notmyidea.org>2011-10-08 15:52:12 +0200
committerAlexis Metaireau <alexis@notmyidea.org>2011-10-08 15:52:12 +0200
commit75209aeed0140c804047b4f3466d329b9eb246b9 (patch)
tree51cbe453bc31e3418e050f0e780ac99e3c57ba92 /budget/web.py
parent1338653bd2234a60eab368f58dcd8d2bcb3f3d6b (diff)
downloadihatemoney-mirror-75209aeed0140c804047b4f3466d329b9eb246b9.zip
ihatemoney-mirror-75209aeed0140c804047b4f3466d329b9eb246b9.tar.gz
ihatemoney-mirror-75209aeed0140c804047b4f3466d329b9eb246b9.tar.bz2
Add a password recovery feature. Fix #32
Diffstat (limited to 'budget/web.py')
-rw-r--r--budget/web.py20
1 files changed, 18 insertions, 2 deletions
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("/<project_id>/edit", methods=["GET", "POST"])
def edit_project():
form = EditProjectForm()