Skip to content

Commit 35a45ec

Browse files
committed
Use Altcha challenge on admin login page
Signed-off-by: Keshav Priyadarshi <git@keshav.space>
1 parent 46d4c04 commit 35a45ec

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

setup.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ install_requires =
6565
crispy-bootstrap4>=2024.1
6666
django-environ>=0.11.0
6767
gunicorn>=23.0.0
68+
django-altcha==0.2.0
6869

6970
# for the API doc
7071
drf-spectacular[sidecar]>=0.24.2

vulnerabilities/forms.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from django import forms
1111
from django.contrib.admin.forms import AdminAuthenticationForm
1212
from django.core.validators import validate_email
13+
from django_altcha import AltchaField
1314
from django_recaptcha.fields import ReCaptchaField
1415
from django_recaptcha.widgets import ReCaptchaV2Checkbox
1516

@@ -102,9 +103,6 @@ class PipelineSchedulePackageForm(forms.Form):
102103

103104

104105
class AdminLoginForm(AdminAuthenticationForm):
105-
captcha = ReCaptchaField(
106-
error_messages={
107-
"required": ("Captcha is required"),
108-
},
109-
widget=ReCaptchaV2Checkbox(),
106+
captcha = AltchaField(
107+
floating=True,
110108
)

vulnerablecode/settings.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@
8585
"drf_spectacular_sidecar",
8686
"django_recaptcha",
8787
"django_rq",
88+
"django_altcha",
8889
)
8990

9091
if env.str("RECAPTCHA_PUBLIC_KEY", None):

vulnerablecode/urls.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,10 +137,10 @@ def __init__(self, *args, **kwargs):
137137
TemplateView.as_view(template_name="tos.html"),
138138
name="api_tos",
139139
),
140-
# path(
141-
# "admin/",
142-
# admin.site.urls,
143-
# ),
140+
path(
141+
"admin/",
142+
admin.site.urls,
143+
),
144144
]
145145

146146
if DEBUG:

0 commit comments

Comments
 (0)