mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-01-25 01:12:16 +00:00
Okay, put that back where it was because I inavertently overloaded my import
Flashbacks to my java days...
This commit is contained in:
@@ -409,8 +409,7 @@ class RecieveForumWebhook(generic.View):
|
|||||||
return super().dispatch(request, *args, **kwargs)
|
return super().dispatch(request, *args, **kwargs)
|
||||||
|
|
||||||
def post(self, 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.new(env('FORUM_WEBHOOK_SECRET').encode(), request.body, hashlib.sha256).hexdigest()}"
|
||||||
computed = f"sha256={hmac}"
|
|
||||||
print(computed)
|
print(computed)
|
||||||
if not hmac.compare_digest(request.POST.get('X-Discourse-Event-Signature'), computed):
|
if not hmac.compare_digest(request.POST.get('X-Discourse-Event-Signature'), computed):
|
||||||
return HttpResponseForbidden('Invalid signature header')
|
return HttpResponseForbidden('Invalid signature header')
|
||||||
|
|||||||
Reference in New Issue
Block a user