Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% extends "base.html" %}
{% load common_form_tags honeypot %}
{% load common_form_tags %}

{% block content %}
<main class="container mx-auto px-4 py-6">
Expand All @@ -17,7 +17,6 @@ <h1>Register</h1>
<form method="post" action="" class="max-w-md">
{% csrf_token %}

{% render_honeypot_field honeypot_field_name %}

<fieldset class="space-y-4">
<legend class="sr-only">Registration Information</legend>
Expand Down
7 changes: 0 additions & 7 deletions accounts/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,6 @@ def test_user_without_subscription_is_not_subscriber(self) -> None:
self.assertFalse(self.user.is_subscriber)


class HoneypotTest(TestCase):
def test_register_page_contains_honeypot_field(self):
response = self.client.get(reverse("django_registration_register"))
self.assertContains(
response,
settings.HONEYPOT_FIELD_NAME,
)


class CustomLoginViewTests(TestCase):
Expand Down
11 changes: 1 addition & 10 deletions accounts/views.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
from typing import Any
from django.conf import settings
from django.utils.decorators import method_decorator
from django.contrib import messages

from django_registration.backends.activation.views import RegistrationView # type: ignore
from honeypot.decorators import check_honeypot # type: ignore

from accounts.forms import CustomUserForm
from django.contrib.auth.views import PasswordResetView, LoginView
Expand All @@ -13,19 +11,12 @@
from urllib.parse import urlparse


@method_decorator(check_honeypot, name="post")
class CustomRegistrationView(RegistrationView):
form_class = CustomUserForm
success_url = "/"
template_name = "django_registration/registration_form.html"

def get_context_data(self, **kwargs: Any) -> dict[str, Any]:
"""Add honeypot field to context."""
context = super().get_context_data(**kwargs)

context["honeypot_field_name"] = settings.HONEYPOT_FIELD_NAME

return context


def form_valid(self, form):
check_email_message = """Thanks for starting to register an account on our website.
Expand Down
3 changes: 0 additions & 3 deletions core/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,6 @@
"django_browser_reload",
"django_extensions",
"django_flatpickr",
"honeypot",
"modelcluster",
"storages",
"taggit",
Expand Down Expand Up @@ -398,8 +397,6 @@
"127.0.0.1",
]

# Honeypot settings
HONEYPOT_FIELD_NAME = "email2"


MESSAGE_TAGS = {
Expand Down
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,6 @@ django==5.2.4 ; python_full_version >= '3.12' \
# django-extensions
# django-filter
# django-flatpickr
# django-honeypot
# django-modelcluster
# django-permissionedforms
# django-registration
Expand Down