aboutsummaryrefslogtreecommitdiff
path: root/ignis/views.py
diff options
context:
space:
mode:
authorBobby <[email protected]>2022-12-28 07:51:38 -0500
committerBobby <[email protected]>2022-12-28 07:51:38 -0500
commit54988a928d37fc12e1f6eb83c6ecfc2babe55e29 (patch)
tree42f5a62061fc3b0a4e70484d6bfb4afe184224d1 /ignis/views.py
parent3ff3acef57e95ecd2e8dde429d4735e7c2e8e684 (diff)
downloadthatcomputerscientist-54988a928d37fc12e1f6eb83c6ecfc2babe55e29.tar.xz
thatcomputerscientist-54988a928d37fc12e1f6eb83c6ecfc2babe55e29.zip
Registraion function with captcha working
Diffstat (limited to 'ignis/views.py')
-rw-r--r--ignis/views.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/ignis/views.py b/ignis/views.py
index 1e822cbf..211346eb 100644
--- a/ignis/views.py
+++ b/ignis/views.py
@@ -9,6 +9,8 @@ from .models import PostImage, RepositoryTitle
import json
import requests
from django.core.files.base import ContentFile
+from captcha.image import ImageCaptcha
+from users.tokens import CaptchaTokenGenerator
# from .github import get_cover
# Create your views here.
@@ -134,3 +136,9 @@ def upload_image(request):
return HttpResponse(json.dumps(response), content_type='application/json')
return HttpResponse('Method not allowed', status=405)
+def captcha_image(request, captcha_string):
+ captcha = CaptchaTokenGenerator().decrypt(captcha_string)
+ imgcaptcha = ImageCaptcha()
+ data = imgcaptcha.generate(captcha)
+ return HttpResponse(data, content_type='image/png')
+