fix
This commit is contained in:
@@ -1066,7 +1066,8 @@ class RegistrationFormSex(RegistrationFormUniqueEmail):
|
||||
month=4,
|
||||
day=15))
|
||||
|
||||
url = HoneypotField(label="URL")
|
||||
hp_field = HoneypotField(label="URL")
|
||||
timestamp = forms.CharField(widget=forms.HiddenInput(), required=False)
|
||||
|
||||
def clean_birthdate(self):
|
||||
dob = self.cleaned_data['birthdate']
|
||||
@@ -1087,6 +1088,22 @@ class RegistrationFormSex(RegistrationFormUniqueEmail):
|
||||
adaptiveclass = forms.ChoiceField(label='Adaptive Classification',
|
||||
choices=adaptivecategories, initial='None', required=False)
|
||||
|
||||
captcha = ReCaptchaField(widget=ReCaptchaV3(
|
||||
attrs={
|
||||
'required_score': 0.85,
|
||||
}))
|
||||
|
||||
|
||||
def clean(self):
|
||||
cleaned_data = super().clean()
|
||||
timestamp = cleaned_data.get('timestamp')
|
||||
if timestamp:
|
||||
submission_time = timezone.now()
|
||||
form_render_time = timezone.datetime.fromtimestamp(float(timestamp), tz=timezone.get_current_timezone())
|
||||
if (submission_time - form_render_time).seconds < 3:
|
||||
raise forms.ValidationError("Form submitted too quickly. Are you a bot?")
|
||||
return cleaned_data
|
||||
|
||||
|
||||
class PowerIntervalUpdateForm(forms.Form):
|
||||
selectorchoices = (
|
||||
|
||||
Reference in New Issue
Block a user