Skip to content

Commit bad10a3

Browse files
committed
fix security #1
1 parent 4d8ba23 commit bad10a3

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

captcha/views.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
11
from django.shortcuts import redirect
2+
from rest_framework.response import Response
3+
from rest_framework import status
24

35
from .captchas import setcaptcha
46

57
# Create your views here.
68
def getcaptcha(request, key):
9+
if not key.isdigit():
10+
return Response({
11+
"detail": "Only digit is allow in captcha key"
12+
}, status=status.HTTP_400_BAD_REQUEST)
13+
714
setcaptcha(key)
815
return redirect("/media/captcha/{name}.png".format(name=key))

0 commit comments

Comments
 (0)