From 43cb0872ae972eada4c02b18fcf5bf36ce256f7c Mon Sep 17 00:00:00 2001 From: Arnau Casas Date: Sat, 28 Oct 2023 14:17:43 +0200 Subject: [PATCH] Added reject and added cookie samesite strict --- app/settings.py | 2 ++ friends/templates/invite_friends.html | 2 +- friends/views.py | 4 +-- review/emails.py | 4 +-- review/templates/application_list.html | 11 +++++-- review/templates/mails/application_invite.txt | 1 - ...ml => application_invite_or_waitlist.html} | 2 +- .../mails/application_invite_or_waitlist.txt | 1 + review/views.py | 32 ++++++++++--------- 9 files changed, 35 insertions(+), 24 deletions(-) delete mode 100644 review/templates/mails/application_invite.txt rename review/templates/mails/{application_invite.html => application_invite_or_waitlist.html} (85%) create mode 100644 review/templates/mails/application_invite_or_waitlist.txt diff --git a/app/settings.py b/app/settings.py index 6226cba..2f98495 100644 --- a/app/settings.py +++ b/app/settings.py @@ -377,6 +377,8 @@ } SESSION_COOKIE_AGE = 86400 +SESSION_COOKIE_SAMESITE = "Strict" +CSRF_COOKIE_SAMESITE = "Strict" # Cache system CACHES = { diff --git a/friends/templates/invite_friends.html b/friends/templates/invite_friends.html index a55f97d..e054b16 100644 --- a/friends/templates/invite_friends.html +++ b/friends/templates/invite_friends.html @@ -3,7 +3,7 @@ {% block invite_list_title %}

{% translate 'Friend list invite' %}

diff --git a/friends/views.py b/friends/views.py index 504dfcd..c14038a 100644 --- a/friends/views.py +++ b/friends/views.py @@ -16,7 +16,7 @@ from friends.forms import FriendsForm from friends.models import FriendsCode from friends.tables import FriendInviteTable -from review.emails import get_invitation_email +from review.emails import get_invitation_or_waitlist_email from review.views import ReviewApplicationTabsMixin, ApplicationListInvite from user.mixins import LoginRequiredMixin, IsOrganizerMixin from django.utils.translation import gettext_lazy as _ @@ -125,7 +125,7 @@ def post(self, request, *args, **kwargs): application.save() log.save() invited += 1 - emails.add(get_invitation_email(request, application)) + emails.add(get_invitation_or_waitlist_email(request, application)) except Error: error += 1 emails = emails.send_all() diff --git a/review/emails.py b/review/emails.py index efcc081..18e6a39 100644 --- a/review/emails.py +++ b/review/emails.py @@ -21,9 +21,9 @@ def send_dubious_email(request, application, reason, name): bcc=[request.user.email, ], request=request).send() -def get_invitation_email(request, application): +def get_invitation_or_waitlist_email(request, application): context = { 'application': application, 'url': request.build_absolute_uri(reverse('home')), } - return Email(name='application_invite', context=context, to=application.user.email, request=request) + return Email(name='application_invite_or_waitlist', context=context, to=application.user.email, request=request) diff --git a/review/templates/application_list.html b/review/templates/application_list.html index 0852107..a564278 100644 --- a/review/templates/application_list.html +++ b/review/templates/application_list.html @@ -95,7 +95,7 @@

{% translate 'Invite applications' %}

{% if not application_type.auto_confirm and perms|add_type:application_type.name|has_application_perm:'can_invite_application' %}
- {% translate 'Invite' %} + {% translate 'Invite or reject' %}
{% endif %} {% else %} @@ -108,12 +108,15 @@

{% translate 'Invite applications' %}

{% csrf_token %} {% include 'components/table.html' %}
- +
{% block more_invites %}
{% translate 'Group by friends' %}
+
+ +
{% endblock %}