From 84862ec84adfe6e8b3b1317a8f10233e431741d9 Mon Sep 17 00:00:00 2001 From: Glandos Date: Sun, 10 Oct 2021 23:16:28 +0200 Subject: [PATCH] rename endpoint to match verb --- ihatemoney/templates/invitation_mail.en.j2 | 2 +- ihatemoney/templates/invitation_mail.fr.j2 | 2 +- ihatemoney/templates/send_invites.html | 4 ++-- ihatemoney/web.py | 7 ++----- 4 files changed, 6 insertions(+), 9 deletions(-) diff --git a/ihatemoney/templates/invitation_mail.en.j2 b/ihatemoney/templates/invitation_mail.en.j2 index 8523eb6b..bb38b9aa 100644 --- a/ihatemoney/templates/invitation_mail.en.j2 +++ b/ihatemoney/templates/invitation_mail.en.j2 @@ -4,7 +4,7 @@ Someone using the email address {{ g.project.contact_email }} invited you to sha It's as simple as saying what did you pay for, for whom, and how much did it cost you, we are caring about the rest. -You can log in using this link: {{ url_for(".invitation", _external=True, project_id=g.project.id, token=g.project.generate_token()) }}. +You can log in using this link: {{ url_for(".join_project", _external=True, project_id=g.project.id, token=g.project.generate_token()) }}. Once logged-in, you can use the following link which is easier to remember: {{ url_for(".list_bills", _external=True) }} If your cookie gets deleted or if you log out, you will need to log back in using the first link. diff --git a/ihatemoney/templates/invitation_mail.fr.j2 b/ihatemoney/templates/invitation_mail.fr.j2 index 828c3338..0cf02f43 100644 --- a/ihatemoney/templates/invitation_mail.fr.j2 +++ b/ihatemoney/templates/invitation_mail.fr.j2 @@ -4,7 +4,7 @@ Quelqu'un dont l'adresse email est {{ g.project.contact_email }} vous a invité Il suffit de renseigner qui a payé pour quoi, pour qui, combien ça a coûté, et on s’occupe du reste. -Vous pouvez vous connecter grâce à ce lien : {{ url_for(".invitation", _external=True, project_id=g.project.id, token=g.project.generate_token()) }}. +Vous pouvez vous connecter grâce à ce lien : {{ url_for(".join_project", _external=True, project_id=g.project.id, token=g.project.generate_token()) }}. Une fois connecté, vous pourrez utiliser le lien suivant qui est plus facile à mémoriser : {{ url_for(".list_bills", _external=True) }} Si vous êtes déconnecté volontairement ou non, vous devrez utiliser à nouveau le premier lien. diff --git a/ihatemoney/templates/send_invites.html b/ihatemoney/templates/send_invites.html index 1a952f2b..d5112926 100644 --- a/ihatemoney/templates/send_invites.html +++ b/ihatemoney/templates/send_invites.html @@ -21,8 +21,8 @@ {{ _("You can directly share the following link via your prefered medium") }}
- - {{ url_for(".invitation", _external=True, project_id=g.project.id, token=g.project.generate_token()) }} + + {{ url_for(".join_project", _external=True, project_id=g.project.id, token=g.project.generate_token()) }} diff --git a/ihatemoney/web.py b/ihatemoney/web.py index 6e8dbb88..d43b49ea 100644 --- a/ihatemoney/web.py +++ b/ihatemoney/web.py @@ -143,7 +143,7 @@ def pull_project(endpoint, values): raise Redirect303(url_for(".create_project", project_id=project_id)) is_admin = session.get("is_admin") - is_invitation = endpoint == "main.invitation" + is_invitation = endpoint == "main.join_project" if session.get(project.id) or is_admin or is_invitation: # add project into kwargs and call the original function g.project = project @@ -196,11 +196,8 @@ def admin(): ) -# To avoid matching other endpoint with a malformed token, -# ensure that it has a point in the middle, since it's the -# default separator between payload and signature. @main.route("//join/", methods=["GET"]) -def invitation(token): +def join_project(token): project_id = g.project.id verified_project_id = Project.verify_token( token, token_type="auth", project_id=project_id