fixed spaces and stuff getting into the level id

This commit is contained in:
Walter 2025-02-24 10:52:35 +01:00
parent f333e1e53f
commit 816b168c72

View File

@ -1,3 +1,4 @@
import string
import json import json
from django.contrib.auth.decorators import login_required from django.contrib.auth.decorators import login_required
@ -23,6 +24,7 @@ class CSRFexemptTemplateView(TemplateView):
class LoadLevel(CSRFexemptTemplateView): class LoadLevel(CSRFexemptTemplateView):
def post(self, request, *args, **kwargs): def post(self, request, *args, **kwargs):
level_id = request.POST.get("level_id") level_id = request.POST.get("level_id")
level_id = "".join(x for x in level_id if x in string.digits)
if level_id is None or not level_id.isdigit(): if level_id is None or not level_id.isdigit():
return HttpResponseBadRequest() return HttpResponseBadRequest()