From 97a3555e818ad0706c34cb3ee0bba5813327608f Mon Sep 17 00:00:00 2001 From: pacnpal <183241239+pacnpal@users.noreply.github.com> Date: Wed, 13 Nov 2024 16:10:25 +0000 Subject: [PATCH] Bypass Turnstile validation when DEBUG is True --- accounts/mixins.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/accounts/mixins.py b/accounts/mixins.py index b2dc7516..850793c0 100644 --- a/accounts/mixins.py +++ b/accounts/mixins.py @@ -5,11 +5,16 @@ from django.core.exceptions import ValidationError class TurnstileMixin: """ Mixin to handle Cloudflare Turnstile validation. + Bypasses validation when DEBUG is True. """ def validate_turnstile(self, request): """ Validate the Turnstile response token. + Skips validation when DEBUG is True. """ + if settings.DEBUG: + return + token = request.POST.get('cf-turnstile-response') if not token: raise ValidationError('Please complete the Turnstile challenge.')