aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexis Metaireau <alexis@notmyidea.org>2011-08-21 22:20:50 +0200
committerAlexis Metaireau <alexis@notmyidea.org>2011-08-21 22:20:50 +0200
commit63777c16bc90560a20184b5cd6c99e947842dfce (patch)
treebd6c713025ed04df7bf22ee2e9b8433df6f8b5cf
parent16fcfd284e3a99bc57449f18501e6f75e91c9d94 (diff)
downloadihatemoney-mirror-63777c16bc90560a20184b5cd6c99e947842dfce.zip
ihatemoney-mirror-63777c16bc90560a20184b5cd6c99e947842dfce.tar.gz
ihatemoney-mirror-63777c16bc90560a20184b5cd6c99e947842dfce.tar.bz2
authentication dance
-rw-r--r--budget/templates/invitation_mail2
-rw-r--r--budget/web.py15
2 files changed, 8 insertions, 9 deletions
diff --git a/budget/templates/invitation_mail b/budget/templates/invitation_mail
index 62f2ff2..2844efd 100644
--- a/budget/templates/invitation_mail
+++ b/budget/templates/invitation_mail
@@ -1,6 +1,6 @@
Hi,
-Someone using the email adress {{ g.project.contact_email }} invited you to share your expenses for {{ g.project.name }} on our application.
+Someone using the email adress {{ g.project.contact_email }} invited you to share your expenses for "{{ g.project.name }}".
It's as simple as saying what did you paid for, for who, and how much did it cost you, we are caring about the rest.
diff --git a/budget/web.py b/budget/web.py
index d91bbb7..fa3f485 100644
--- a/budget/web.py
+++ b/budget/web.py
@@ -47,13 +47,14 @@ def pull_project(endpoint, values):
else:
# redirect to authentication page
raise RequestRedirect(
- url_for("authenticate", redirect_url=request.url,
- project_id=project_id))
+ url_for("authenticate", project_id=project_id))
@app.route("/authenticate", methods=["GET", "POST"])
-def authenticate(redirect_url=None, project_id=None):
+def authenticate(project_id=None):
form = AuthenticationForm()
- project_id = form.id.data or request.args['project_id']
+ if not form.id.data and request.args['project_id']:
+ form.id.data = request.args['project_id']
+ project_id = form.id.data
project = Project.query.get(project_id)
create_project = False # We don't want to create the project by default
if not project:
@@ -65,8 +66,7 @@ def authenticate(redirect_url=None, project_id=None):
# if credentials are already in session, redirect
if project_id in session and project.password == session[project_id]:
setattr(g, 'project', project)
- redirect_url = redirect_url or url_for("list_bills")
- return redirect(redirect_url)
+ return redirect(url_for("list_bills"))
# else process the form
if request.method == "POST":
@@ -82,8 +82,7 @@ def authenticate(redirect_url=None, project_id=None):
session[project_id] = form.password.data
session.update()
setattr(g, 'project', project)
- redirect_url = redirect_url or url_for("list_bills")
- return redirect(redirect_url)
+ return redirect(url_for("list_bills"))
return render_template("authenticate.html", form=form,
create_project=create_project)