Browse Source

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

pull/199/head
Pēteris Caune 6 years ago
parent
commit
9f02371d6a
No known key found for this signature in database GPG Key ID: E28D7679E9A9EDE2
2 changed files with 7 additions and 1 deletions
  1. +5
    -1
      hc/accounts/models.py
  2. +2
    -0
      hc/accounts/views.py

+ 5
- 1
hc/accounts/models.py 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,


+ 2
- 0
hc/accounts/views.py 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:


Loading…
Cancel
Save