mirror of
https://github.com/peeringdb/peeringdb.git
synced 2024-05-11 05:55:09 +00:00
Prep 2.29 (#1024)
* django3, py39, lgtm, linting (#715) * IX-F Importer: ticket status change when posting re-occuring conflict to existing resolved ticket (#920) * fix recaptcha requirement for user creation in django-admin (#715) * IX-F Importer: fix command output buffering #967 * Drop dot1q_support field #903 * fix test (#967) * Add name, city, country to ixfac (GET operation) #166 * additional tests fir #166 * Allow IXP to trigger ix-f importer for their exchange #779 * add docker compose for dev * add selinux labels for mountpoints * fixes #1013: The process to permanently remove old soft-deleted network contacts pdb_delete_pocs raises a false ProtectedAction * fix api test * relock poetry * remove django_namespace_perms from installed apps * fix user permissios ui * remove remaining references to django namespace perms * linting * copy tox.ini * comment flake8 check until we figure out why it ignores configs from tox.ini * black format * poetry lock Co-authored-by: Stefan Pratter <stefan@20c.com>
This commit is contained in:
@@ -8,11 +8,10 @@ from django.conf import settings as dj_settings
|
||||
from django.contrib.auth import forms as auth_forms
|
||||
from django.utils import timezone
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from grainy.const import *
|
||||
from grainy.const import PERM_CRUD, PERM_DENY, PERM_READ
|
||||
|
||||
from peeringdb_server.inet import get_client_ip
|
||||
from peeringdb_server.models import Organization, OrganizationAPIKey, User
|
||||
from peeringdb_server.util import PERM_CRUD
|
||||
from peeringdb_server.models import Organization, User
|
||||
|
||||
|
||||
class OrganizationAPIKeyForm(forms.Form):
|
||||
@@ -109,6 +108,8 @@ class UserCreationForm(auth_forms.UserCreationForm):
|
||||
captcha = forms.CharField(required=False)
|
||||
captcha_generator = CaptchaField(required=False)
|
||||
|
||||
require_captcha = True
|
||||
|
||||
class Meta:
|
||||
model = User
|
||||
fields = (
|
||||
@@ -123,7 +124,9 @@ class UserCreationForm(auth_forms.UserCreationForm):
|
||||
recaptcha = self.cleaned_data.get("recaptcha", "")
|
||||
captcha = self.cleaned_data.get("captcha", "")
|
||||
|
||||
if not recaptcha and not captcha:
|
||||
if not self.require_captcha:
|
||||
return
|
||||
elif not recaptcha and not captcha:
|
||||
raise forms.ValidationError(
|
||||
_("Please fill out the anti-spam challenge (captcha) field")
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user