mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-01-17 05:22:16 +00:00
Bypass hCaptcha in automated testing
This commit is contained in:
@@ -2,14 +2,20 @@ from hcaptcha.fields import hCaptchaField
|
||||
from django import forms
|
||||
from django.contrib.auth.forms import (AuthenticationForm, PasswordResetForm,
|
||||
UserChangeForm, UserCreationForm)
|
||||
from django.conf import settings
|
||||
from registration.forms import RegistrationFormUniqueEmail
|
||||
|
||||
from RIGS import models
|
||||
|
||||
class CaptchaField(hCaptchaField):
|
||||
def validate(self, value):
|
||||
# Skip validation if we're testing FIXME: Arona, y u so lazy
|
||||
if settings.HCAPTCHA_SITEKEY != '10000000-ffff-ffff-ffff-000000000001':
|
||||
super().validate(value)
|
||||
|
||||
# Registration
|
||||
class ProfileRegistrationFormUniqueEmail(RegistrationFormUniqueEmail):
|
||||
hcaptcha = hCaptchaField()
|
||||
hcaptcha = CaptchaField()
|
||||
|
||||
class Meta:
|
||||
model = models.Profile
|
||||
@@ -41,7 +47,7 @@ class EmbeddedAuthenticationForm(CheckApprovedForm):
|
||||
|
||||
|
||||
class PasswordReset(PasswordResetForm):
|
||||
hcaptcha = hCaptchaField()
|
||||
hcaptcha = CaptchaField()
|
||||
|
||||
|
||||
class ProfileCreationForm(UserCreationForm):
|
||||
|
||||
Reference in New Issue
Block a user