Report unsubscribe link works with POST. Include "X-Bounce-Url" header in report emails.

This commit is contained in:
Pēteris Caune 2018-10-24 10:06:51 +03:00
parent df86fd29b3
commit 9f02371d6a
No known key found for this signature in database
GPG Key ID: E28D7679E9A9EDE2
2 changed files with 7 additions and 1 deletions

View File

@ -152,7 +152,11 @@ class Profile(models.Model):
unsub_url = self.reports_unsub_url()
headers = {"List-Unsubscribe": unsub_url}
headers = {
"List-Unsubscribe": unsub_url,
"X-Bounce-Url": unsub_url
}
ctx = {
"checks": checks,
"sort": self.sort,

View File

@ -13,6 +13,7 @@ from django.core import signing
from django.http import HttpResponseForbidden, HttpResponseBadRequest
from django.shortcuts import redirect, render
from django.utils.timezone import now
from django.views.decorators.csrf import csrf_exempt
from django.views.decorators.http import require_POST
from hc.accounts.forms import (ChangeEmailForm, EmailPasswordForm,
InviteTeamMemberForm, RemoveTeamMemberForm,
@ -344,6 +345,7 @@ def change_email_done(request):
return render(request, "accounts/change_email_done.html")
@csrf_exempt
def unsubscribe_reports(request, username):
signer = signing.TimestampSigner(salt="reports")
try: