From 32c8573c718b0bf88b59e54f5c1ad07f3eb29358 Mon Sep 17 00:00:00 2001 From: FreneticScribbler Date: Mon, 26 Jun 2023 23:33:25 +0100 Subject: [PATCH] Third shot --- RIGS/views/rigboard.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/RIGS/views/rigboard.py b/RIGS/views/rigboard.py index 76dce141..102fe56f 100644 --- a/RIGS/views/rigboard.py +++ b/RIGS/views/rigboard.py @@ -408,8 +408,9 @@ class RecieveForumWebhook(generic.View): def post(self, request, *args, **kwargs): signer = signing.Signer(key=env('FORUM_WEBHOOK_SECRET')) - if request.POST.get('X-Discourse-Event-Signature') == signer.sign(request.POST.body): - event_id = int(request.POST.body['title'][1:5]) # find the ID, force convert it to an int to eliminate leading zeros + if request.POST.get('X-Discourse-Event-Signature') == signer.sign(request.body): + body = json.loads(request.body.decode('utf-8')) + event_id = int(body['title'][1:5]) # find the ID, force convert it to an int to eliminate leading zeros event = models.Event.objects.filter(pk=event_id).first() if event: event.forum_url = "https://forum.nottinghamtec.co.uk/t/{}"