Okay, put that back where it was because I inavertently overloaded my import

Flashbacks to my java days...
This commit is contained in:
2023-06-27 00:48:25 +01:00
parent b5b8dc104c
commit 15230cb361

View File

@@ -409,8 +409,7 @@ class RecieveForumWebhook(generic.View):
return super().dispatch(request, *args, **kwargs)
def post(self, request, *args, **kwargs):
hmac = hmac.new(env('FORUM_WEBHOOK_SECRET').encode(), request.body, hashlib.sha256).hexdigest()
computed = f"sha256={hmac}"
computed = f"sha256={hmac.new(env('FORUM_WEBHOOK_SECRET').encode(), request.body, hashlib.sha256).hexdigest()}"
print(computed)
if not hmac.compare_digest(request.POST.get('X-Discourse-Event-Signature'), computed):
return HttpResponseForbidden('Invalid signature header')