mirror of
https://github.com/pacnpal/thrillwiki_django_no_react.git
synced 2025-12-20 07:11:08 -05:00
Bypass Turnstile validation when DEBUG is True
This commit is contained in:
@@ -5,11 +5,16 @@ from django.core.exceptions import ValidationError
|
|||||||
class TurnstileMixin:
|
class TurnstileMixin:
|
||||||
"""
|
"""
|
||||||
Mixin to handle Cloudflare Turnstile validation.
|
Mixin to handle Cloudflare Turnstile validation.
|
||||||
|
Bypasses validation when DEBUG is True.
|
||||||
"""
|
"""
|
||||||
def validate_turnstile(self, request):
|
def validate_turnstile(self, request):
|
||||||
"""
|
"""
|
||||||
Validate the Turnstile response token.
|
Validate the Turnstile response token.
|
||||||
|
Skips validation when DEBUG is True.
|
||||||
"""
|
"""
|
||||||
|
if settings.DEBUG:
|
||||||
|
return
|
||||||
|
|
||||||
token = request.POST.get('cf-turnstile-response')
|
token = request.POST.get('cf-turnstile-response')
|
||||||
if not token:
|
if not token:
|
||||||
raise ValidationError('Please complete the Turnstile challenge.')
|
raise ValidationError('Please complete the Turnstile challenge.')
|
||||||
|
|||||||
Reference in New Issue
Block a user