mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-01-27 10:22:17 +00:00
Correct method of CRSF exemption for webhook reciever
This commit is contained in:
@@ -398,11 +398,14 @@ class CreateForumThread(generic.base.RedirectView):
|
|||||||
'body': '<span class="hidden" id="event-id">{}</span>https://rigs.nottinghamtec.co.uk/event/{}'.format(event.pk, event.pk),
|
'body': '<span class="hidden" id="event-id">{}</span>https://rigs.nottinghamtec.co.uk/event/{}'.format(event.pk, event.pk),
|
||||||
'category': 'rig-info'
|
'category': 'rig-info'
|
||||||
}
|
}
|
||||||
return 'https://forum.nottinghamtec.co.uk/new-topic' + "?" + urllib.parse.urlencode(params)
|
return f'https://forum.nottinghamtec.co.uk/new-topic?{}'.format(urllib.parse.urlencode(params))
|
||||||
|
|
||||||
|
|
||||||
class RecieveForumWebhook(generic.View):
|
class RecieveForumWebhook(generic.View):
|
||||||
@csrf_exempt
|
@method_decorator(csrf_exempt)
|
||||||
|
def dispatch(self, request, *args, **kwargs):
|
||||||
|
return super().dispatch(request, *args, **kwargs)
|
||||||
|
|
||||||
def post(self, request, *args, **kwargs):
|
def post(self, request, *args, **kwargs):
|
||||||
if request.POST.get('secret') == env('FORUM_WEBHOOK_SECRET'):
|
if request.POST.get('secret') == env('FORUM_WEBHOOK_SECRET'):
|
||||||
event_id = BeautifulSoup(request.POST.get('body'), "html.parser")
|
event_id = BeautifulSoup(request.POST.get('body'), "html.parser")
|
||||||
|
|||||||
Reference in New Issue
Block a user