mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-01-17 21:42:14 +00:00
Different header access method
This commit is contained in:
@@ -411,7 +411,7 @@ class RecieveForumWebhook(generic.View):
|
||||
def post(self, request, *args, **kwargs):
|
||||
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):
|
||||
if not hmac.compare_digest(request.headers.get('X-Discourse-Event-Signature'), computed):
|
||||
return HttpResponseForbidden('Invalid signature header')
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user