Remove django-registration-redux
This commit is contained in:
parent
105371abaf
commit
3160becb72
23 changed files with 11 additions and 704 deletions
|
|
@ -10,7 +10,6 @@ dependencies = [
|
||||||
'psycopg',
|
'psycopg',
|
||||||
'django-axes',
|
'django-axes',
|
||||||
'django-celery-beat~=2.7.0',
|
'django-celery-beat~=2.7.0',
|
||||||
'django-registration-redux~=2.7',
|
|
||||||
'django-rest-framework',
|
'django-rest-framework',
|
||||||
'djangorestframework-camel-case',
|
'djangorestframework-camel-case',
|
||||||
'pymemcache',
|
'pymemcache',
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,6 @@ from django.utils.crypto import get_random_string
|
||||||
|
|
||||||
import factory
|
import factory
|
||||||
|
|
||||||
from registration.models import RegistrationProfile
|
|
||||||
|
|
||||||
from newsreader.accounts.models import User
|
from newsreader.accounts.models import User
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -29,11 +27,3 @@ class UserFactory(factory.django.DjangoModelFactory):
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = User
|
model = User
|
||||||
|
|
||||||
|
|
||||||
class RegistrationProfileFactory(factory.django.DjangoModelFactory):
|
|
||||||
user = factory.SubFactory(UserFactory)
|
|
||||||
activation_key = factory.LazyFunction(get_activation_key)
|
|
||||||
|
|
||||||
class Meta:
|
|
||||||
model = RegistrationProfile
|
|
||||||
|
|
|
||||||
|
|
@ -1,99 +0,0 @@
|
||||||
import datetime
|
|
||||||
|
|
||||||
from django.conf import settings
|
|
||||||
from django.test import TestCase
|
|
||||||
from django.urls import reverse
|
|
||||||
from django.utils.translation import gettext as _
|
|
||||||
|
|
||||||
from registration.models import RegistrationProfile
|
|
||||||
|
|
||||||
from newsreader.accounts.models import User
|
|
||||||
|
|
||||||
|
|
||||||
class ActivationTestCase(TestCase):
|
|
||||||
def setUp(self):
|
|
||||||
self.register_url = reverse("accounts:register")
|
|
||||||
self.register_success_url = reverse("accounts:register-complete")
|
|
||||||
self.success_url = reverse("accounts:activate-complete")
|
|
||||||
|
|
||||||
def test_activation(self):
|
|
||||||
data = {
|
|
||||||
"email": "test@test.com",
|
|
||||||
"password1": "test12456",
|
|
||||||
"password2": "test12456",
|
|
||||||
}
|
|
||||||
|
|
||||||
response = self.client.post(self.register_url, data)
|
|
||||||
self.assertRedirects(response, self.register_success_url)
|
|
||||||
|
|
||||||
register_profile = RegistrationProfile.objects.get()
|
|
||||||
|
|
||||||
kwargs = {"activation_key": register_profile.activation_key}
|
|
||||||
response = self.client.get(reverse("accounts:activate", kwargs=kwargs))
|
|
||||||
|
|
||||||
self.assertRedirects(response, self.success_url)
|
|
||||||
|
|
||||||
def test_expired_key(self):
|
|
||||||
data = {
|
|
||||||
"email": "test@test.com",
|
|
||||||
"password1": "test12456",
|
|
||||||
"password2": "test12456",
|
|
||||||
}
|
|
||||||
|
|
||||||
response = self.client.post(self.register_url, data)
|
|
||||||
|
|
||||||
register_profile = RegistrationProfile.objects.get()
|
|
||||||
user = register_profile.user
|
|
||||||
|
|
||||||
user.date_joined -= datetime.timedelta(days=settings.ACCOUNT_ACTIVATION_DAYS)
|
|
||||||
user.save()
|
|
||||||
|
|
||||||
kwargs = {"activation_key": register_profile.activation_key}
|
|
||||||
response = self.client.get(reverse("accounts:activate", kwargs=kwargs))
|
|
||||||
|
|
||||||
self.assertEqual(200, response.status_code)
|
|
||||||
self.assertContains(response, _("Account activation failed"))
|
|
||||||
|
|
||||||
user.refresh_from_db()
|
|
||||||
self.assertFalse(user.is_active)
|
|
||||||
|
|
||||||
def test_invalid_key(self):
|
|
||||||
data = {
|
|
||||||
"email": "test@test.com",
|
|
||||||
"password1": "test12456",
|
|
||||||
"password2": "test12456",
|
|
||||||
}
|
|
||||||
|
|
||||||
response = self.client.post(self.register_url, data)
|
|
||||||
self.assertRedirects(response, self.register_success_url)
|
|
||||||
|
|
||||||
kwargs = {"activation_key": "not-a-valid-key"}
|
|
||||||
response = self.client.get(reverse("accounts:activate", kwargs=kwargs))
|
|
||||||
|
|
||||||
self.assertContains(response, _("Account activation failed"))
|
|
||||||
|
|
||||||
user = User.objects.get()
|
|
||||||
|
|
||||||
self.assertEquals(user.is_active, False)
|
|
||||||
|
|
||||||
def test_activated_key(self):
|
|
||||||
data = {
|
|
||||||
"email": "test@test.com",
|
|
||||||
"password1": "test12456",
|
|
||||||
"password2": "test12456",
|
|
||||||
}
|
|
||||||
|
|
||||||
response = self.client.post(self.register_url, data)
|
|
||||||
self.assertRedirects(response, self.register_success_url)
|
|
||||||
|
|
||||||
register_profile = RegistrationProfile.objects.get()
|
|
||||||
|
|
||||||
kwargs = {"activation_key": register_profile.activation_key}
|
|
||||||
response = self.client.get(reverse("accounts:activate", kwargs=kwargs))
|
|
||||||
|
|
||||||
self.assertRedirects(response, self.success_url)
|
|
||||||
|
|
||||||
# try this a second time
|
|
||||||
response = self.client.get(reverse("accounts:activate", kwargs=kwargs))
|
|
||||||
|
|
||||||
self.assertRedirects(response, self.success_url)
|
|
||||||
|
|
@ -1,110 +0,0 @@
|
||||||
from django.core import mail
|
|
||||||
from django.test import TransactionTestCase as TestCase
|
|
||||||
from django.test.utils import override_settings
|
|
||||||
from django.urls import reverse
|
|
||||||
from django.utils.translation import gettext as _
|
|
||||||
|
|
||||||
from registration.models import RegistrationProfile
|
|
||||||
|
|
||||||
from newsreader.accounts.models import User
|
|
||||||
from newsreader.accounts.tests.factories import UserFactory
|
|
||||||
|
|
||||||
|
|
||||||
class RegistrationTestCase(TestCase):
|
|
||||||
def setUp(self):
|
|
||||||
self.url = reverse("accounts:register")
|
|
||||||
self.success_url = reverse("accounts:register-complete")
|
|
||||||
self.disallowed_url = reverse("accounts:register-closed")
|
|
||||||
|
|
||||||
def test_simple(self):
|
|
||||||
response = self.client.get(self.url)
|
|
||||||
|
|
||||||
self.assertEquals(response.status_code, 200)
|
|
||||||
|
|
||||||
def test_registration(self):
|
|
||||||
data = {
|
|
||||||
"email": "test@test.com",
|
|
||||||
"password1": "test12456",
|
|
||||||
"password2": "test12456",
|
|
||||||
}
|
|
||||||
|
|
||||||
response = self.client.post(self.url, data)
|
|
||||||
self.assertRedirects(response, self.success_url)
|
|
||||||
|
|
||||||
self.assertEquals(User.objects.count(), 1)
|
|
||||||
self.assertEquals(RegistrationProfile.objects.count(), 1)
|
|
||||||
|
|
||||||
user = User.objects.get()
|
|
||||||
|
|
||||||
self.assertEquals(user.is_active, False)
|
|
||||||
self.assertEquals(len(mail.outbox), 1)
|
|
||||||
|
|
||||||
def test_existing_email(self):
|
|
||||||
UserFactory(email="test@test.com")
|
|
||||||
|
|
||||||
data = {
|
|
||||||
"email": "test@test.com",
|
|
||||||
"password1": "test12456",
|
|
||||||
"password2": "test12456",
|
|
||||||
}
|
|
||||||
|
|
||||||
response = self.client.post(self.url, data)
|
|
||||||
self.assertEquals(response.status_code, 200)
|
|
||||||
|
|
||||||
self.assertEquals(User.objects.count(), 1)
|
|
||||||
self.assertContains(response, _("User with this Email address already exists"))
|
|
||||||
|
|
||||||
def test_pending_registration(self):
|
|
||||||
data = {
|
|
||||||
"email": "test@test.com",
|
|
||||||
"password1": "test12456",
|
|
||||||
"password2": "test12456",
|
|
||||||
}
|
|
||||||
|
|
||||||
response = self.client.post(self.url, data)
|
|
||||||
self.assertRedirects(response, self.success_url)
|
|
||||||
|
|
||||||
self.assertEquals(User.objects.count(), 1)
|
|
||||||
self.assertEquals(RegistrationProfile.objects.count(), 1)
|
|
||||||
|
|
||||||
user = User.objects.get()
|
|
||||||
|
|
||||||
self.assertEquals(user.is_active, False)
|
|
||||||
self.assertEquals(len(mail.outbox), 1)
|
|
||||||
|
|
||||||
response = self.client.post(self.url, data)
|
|
||||||
self.assertEquals(response.status_code, 200)
|
|
||||||
self.assertContains(response, _("User with this Email address already exists"))
|
|
||||||
|
|
||||||
def test_disabled_account(self):
|
|
||||||
UserFactory(email="test@test.com", is_active=False)
|
|
||||||
|
|
||||||
data = {
|
|
||||||
"email": "test@test.com",
|
|
||||||
"password1": "test12456",
|
|
||||||
"password2": "test12456",
|
|
||||||
}
|
|
||||||
|
|
||||||
response = self.client.post(self.url, data)
|
|
||||||
self.assertEquals(response.status_code, 200)
|
|
||||||
|
|
||||||
self.assertEquals(User.objects.count(), 1)
|
|
||||||
self.assertContains(response, _("User with this Email address already exists"))
|
|
||||||
|
|
||||||
@override_settings(REGISTRATION_OPEN=False)
|
|
||||||
def test_registration_closed(self):
|
|
||||||
response = self.client.get(self.url)
|
|
||||||
|
|
||||||
self.assertRedirects(response, self.disallowed_url)
|
|
||||||
|
|
||||||
data = {
|
|
||||||
"email": "test@test.com",
|
|
||||||
"password1": "test12456",
|
|
||||||
"password2": "test12456",
|
|
||||||
}
|
|
||||||
|
|
||||||
response = self.client.post(self.url, data)
|
|
||||||
self.assertRedirects(response, self.disallowed_url)
|
|
||||||
|
|
||||||
self.assertEquals(User.objects.count(), 0)
|
|
||||||
self.assertEquals(RegistrationProfile.objects.count(), 0)
|
|
||||||
|
|
@ -1,77 +0,0 @@
|
||||||
from django.core import mail
|
|
||||||
from django.test import TransactionTestCase as TestCase
|
|
||||||
from django.urls import reverse
|
|
||||||
from django.utils.translation import gettext as _
|
|
||||||
|
|
||||||
from registration.models import RegistrationProfile
|
|
||||||
|
|
||||||
from newsreader.accounts.tests.factories import RegistrationProfileFactory, UserFactory
|
|
||||||
|
|
||||||
|
|
||||||
class ResendActivationTestCase(TestCase):
|
|
||||||
def setUp(self):
|
|
||||||
self.url = reverse("accounts:activate-resend")
|
|
||||||
self.success_url = reverse("accounts:activate-complete")
|
|
||||||
self.register_url = reverse("accounts:register")
|
|
||||||
|
|
||||||
def test_simple(self):
|
|
||||||
response = self.client.get(self.url)
|
|
||||||
|
|
||||||
self.assertEquals(response.status_code, 200)
|
|
||||||
|
|
||||||
def test_resent_form(self):
|
|
||||||
data = {
|
|
||||||
"email": "test@test.com",
|
|
||||||
"password1": "test12456",
|
|
||||||
"password2": "test12456",
|
|
||||||
}
|
|
||||||
|
|
||||||
response = self.client.post(self.register_url, data)
|
|
||||||
|
|
||||||
register_profile = RegistrationProfile.objects.get()
|
|
||||||
original_kwargs = {"activation_key": register_profile.activation_key}
|
|
||||||
|
|
||||||
response = self.client.post(self.url, {"email": "test@test.com"})
|
|
||||||
|
|
||||||
self.assertContains(response, _("We have sent an email to"))
|
|
||||||
|
|
||||||
self.assertEquals(len(mail.outbox), 2)
|
|
||||||
|
|
||||||
register_profile.refresh_from_db()
|
|
||||||
|
|
||||||
kwargs = {"activation_key": register_profile.activation_key}
|
|
||||||
response = self.client.get(reverse("accounts:activate", kwargs=kwargs))
|
|
||||||
|
|
||||||
self.assertRedirects(response, self.success_url)
|
|
||||||
|
|
||||||
register_profile.refresh_from_db()
|
|
||||||
user = register_profile.user
|
|
||||||
|
|
||||||
self.assertEquals(user.is_active, True)
|
|
||||||
|
|
||||||
# test the old activation code
|
|
||||||
response = self.client.get(reverse("accounts:activate", kwargs=original_kwargs))
|
|
||||||
|
|
||||||
self.assertEquals(response.status_code, 200)
|
|
||||||
self.assertContains(response, _("Account activation failed"))
|
|
||||||
|
|
||||||
def test_existing_account(self):
|
|
||||||
user = UserFactory(is_active=True)
|
|
||||||
RegistrationProfileFactory(user=user, activated=True)
|
|
||||||
|
|
||||||
response = self.client.post(self.url, {"email": user.email})
|
|
||||||
self.assertEquals(response.status_code, 200)
|
|
||||||
|
|
||||||
# default behaviour is to show success page but not send an email
|
|
||||||
self.assertContains(response, _("We have sent an email to"))
|
|
||||||
|
|
||||||
self.assertEquals(len(mail.outbox), 0)
|
|
||||||
|
|
||||||
def test_no_account(self):
|
|
||||||
response = self.client.post(self.url, {"email": "fake@mail.com"})
|
|
||||||
self.assertEquals(response.status_code, 200)
|
|
||||||
|
|
||||||
# default behaviour is to show success page but not send an email
|
|
||||||
self.assertContains(response, _("We have sent an email to"))
|
|
||||||
|
|
||||||
self.assertEquals(len(mail.outbox), 0)
|
|
||||||
|
|
@ -2,9 +2,6 @@ from django.contrib.auth.decorators import login_required
|
||||||
from django.urls import include, path
|
from django.urls import include, path
|
||||||
|
|
||||||
from newsreader.accounts.views import (
|
from newsreader.accounts.views import (
|
||||||
ActivationCompleteView,
|
|
||||||
ActivationResendView,
|
|
||||||
ActivationView,
|
|
||||||
FaviconRedirectView,
|
FaviconRedirectView,
|
||||||
IntegrationsView,
|
IntegrationsView,
|
||||||
LoginView,
|
LoginView,
|
||||||
|
|
@ -17,9 +14,6 @@ from newsreader.accounts.views import (
|
||||||
RedditRevokeRedirectView,
|
RedditRevokeRedirectView,
|
||||||
RedditTemplateView,
|
RedditTemplateView,
|
||||||
RedditTokenRedirectView,
|
RedditTokenRedirectView,
|
||||||
RegistrationClosedView,
|
|
||||||
RegistrationCompleteView,
|
|
||||||
RegistrationView,
|
|
||||||
SettingsView,
|
SettingsView,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -53,24 +47,6 @@ urlpatterns = [
|
||||||
# Auth
|
# Auth
|
||||||
path("login/", LoginView.as_view(), name="login"),
|
path("login/", LoginView.as_view(), name="login"),
|
||||||
path("logout/", LogoutView.as_view(), name="logout"),
|
path("logout/", LogoutView.as_view(), name="logout"),
|
||||||
# Register
|
|
||||||
path("register/", RegistrationView.as_view(), name="register"),
|
|
||||||
path(
|
|
||||||
"register/complete/",
|
|
||||||
RegistrationCompleteView.as_view(),
|
|
||||||
name="register-complete",
|
|
||||||
),
|
|
||||||
path("register/closed/", RegistrationClosedView.as_view(), name="register-closed"),
|
|
||||||
path(
|
|
||||||
"activate/complete/", ActivationCompleteView.as_view(), name="activate-complete"
|
|
||||||
),
|
|
||||||
path("activate/resend/", ActivationResendView.as_view(), name="activate-resend"),
|
|
||||||
path(
|
|
||||||
# This URL should be placed after all activate/ url's (see arg)
|
|
||||||
"activate/<str:activation_key>/",
|
|
||||||
ActivationView.as_view(),
|
|
||||||
name="activate",
|
|
||||||
),
|
|
||||||
# Password
|
# Password
|
||||||
path("password-reset/", PasswordResetView.as_view(), name="password-reset"),
|
path("password-reset/", PasswordResetView.as_view(), name="password-reset"),
|
||||||
path(
|
path(
|
||||||
|
|
|
||||||
|
|
@ -13,14 +13,7 @@ from newsreader.accounts.views.password import (
|
||||||
PasswordResetDoneView,
|
PasswordResetDoneView,
|
||||||
PasswordResetView,
|
PasswordResetView,
|
||||||
)
|
)
|
||||||
from newsreader.accounts.views.registration import (
|
|
||||||
ActivationCompleteView,
|
|
||||||
ActivationResendView,
|
|
||||||
ActivationView,
|
|
||||||
RegistrationClosedView,
|
|
||||||
RegistrationCompleteView,
|
|
||||||
RegistrationView,
|
|
||||||
)
|
|
||||||
from newsreader.accounts.views.settings import SettingsView
|
from newsreader.accounts.views.settings import SettingsView
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
|
|
@ -36,11 +29,5 @@ __all__ = [
|
||||||
"PasswordResetConfirmView",
|
"PasswordResetConfirmView",
|
||||||
"PasswordResetDoneView",
|
"PasswordResetDoneView",
|
||||||
"PasswordResetView",
|
"PasswordResetView",
|
||||||
"ActivationCompleteView",
|
|
||||||
"ActivationResendView",
|
|
||||||
"ActivationView",
|
|
||||||
"RegistrationClosedView",
|
|
||||||
"RegistrationCompleteView",
|
|
||||||
"RegistrationView",
|
|
||||||
"SettingsView",
|
"SettingsView",
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -1,56 +0,0 @@
|
||||||
from django.shortcuts import render
|
|
||||||
from django.urls import reverse_lazy
|
|
||||||
from django.views.generic import TemplateView
|
|
||||||
|
|
||||||
from registration.backends.default import views as registration_views
|
|
||||||
|
|
||||||
from newsreader.utils.views import NavListMixin
|
|
||||||
|
|
||||||
|
|
||||||
# RegistrationView shows a registration form and sends the email
|
|
||||||
# RegistrationCompleteView shows after filling in the registration form
|
|
||||||
# ActivationView is send within the activation email and activates the account
|
|
||||||
# ActivationCompleteView shows the success screen when activation was succesful
|
|
||||||
# ActivationResendView can be used when activation links are expired
|
|
||||||
# RegistrationClosedView shows when registration is disabled
|
|
||||||
class RegistrationView(NavListMixin, registration_views.RegistrationView):
|
|
||||||
disallowed_url = reverse_lazy("accounts:register-closed")
|
|
||||||
template_name = "registration/registration_form.html"
|
|
||||||
success_url = reverse_lazy("accounts:register-complete")
|
|
||||||
|
|
||||||
|
|
||||||
class RegistrationCompleteView(NavListMixin, TemplateView):
|
|
||||||
template_name = "registration/registration_complete.html"
|
|
||||||
|
|
||||||
|
|
||||||
class RegistrationClosedView(NavListMixin, TemplateView):
|
|
||||||
template_name = "registration/registration_closed.html"
|
|
||||||
|
|
||||||
|
|
||||||
# Redirects or renders failed activation template
|
|
||||||
class ActivationView(NavListMixin, registration_views.ActivationView):
|
|
||||||
template_name = "registration/activation_failure.html"
|
|
||||||
|
|
||||||
def get_success_url(self, user):
|
|
||||||
return ("accounts:activate-complete", (), {})
|
|
||||||
|
|
||||||
|
|
||||||
class ActivationCompleteView(NavListMixin, TemplateView):
|
|
||||||
template_name = "registration/activation_complete.html"
|
|
||||||
|
|
||||||
|
|
||||||
# Renders activation form resend or resend_activation_complete
|
|
||||||
class ActivationResendView(NavListMixin, registration_views.ResendActivationView):
|
|
||||||
template_name = "registration/activation_resend_form.html"
|
|
||||||
|
|
||||||
def render_form_submitted_template(self, form):
|
|
||||||
"""
|
|
||||||
Renders resend activation complete template with the submitted email.
|
|
||||||
|
|
||||||
"""
|
|
||||||
email = form.cleaned_data["email"]
|
|
||||||
context = {"email": email}
|
|
||||||
|
|
||||||
return render(
|
|
||||||
self.request, "registration/activation_resend_complete.html", context
|
|
||||||
)
|
|
||||||
|
|
@ -16,7 +16,7 @@ except ImportError:
|
||||||
|
|
||||||
|
|
||||||
BASE_DIR = Path(__file__).resolve().parent.parent.parent.parent
|
BASE_DIR = Path(__file__).resolve().parent.parent.parent.parent
|
||||||
DJANGO_PROJECT_DIR = os.path.join(BASE_DIR, "src", "newsreader")
|
DJANGO_PROJECT_DIR = BASE_DIR / "src" / "newsreader"
|
||||||
|
|
||||||
# Quick-start development settings - unsuitable for production
|
# Quick-start development settings - unsuitable for production
|
||||||
# See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/
|
# See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/
|
||||||
|
|
@ -39,7 +39,6 @@ INSTALLED_APPS = [
|
||||||
"rest_framework",
|
"rest_framework",
|
||||||
"celery",
|
"celery",
|
||||||
"django_celery_beat",
|
"django_celery_beat",
|
||||||
"registration",
|
|
||||||
"axes",
|
"axes",
|
||||||
# app modules
|
# app modules
|
||||||
"newsreader.accounts",
|
"newsreader.accounts",
|
||||||
|
|
@ -256,10 +255,6 @@ SWAGGER_SETTINGS = {
|
||||||
CELERY_WORKER_HIJACK_ROOT_LOGGER = False
|
CELERY_WORKER_HIJACK_ROOT_LOGGER = False
|
||||||
CELERY_BROKER_URL = "amqp://guest@rabbitmq:5672"
|
CELERY_BROKER_URL = "amqp://guest@rabbitmq:5672"
|
||||||
|
|
||||||
REGISTRATION_OPEN = True
|
|
||||||
REGISTRATION_AUTO_LOGIN = True
|
|
||||||
ACCOUNT_ACTIVATION_DAYS = 7
|
|
||||||
|
|
||||||
# Sentry
|
# Sentry
|
||||||
SENTRY_CONFIG = {
|
SENTRY_CONFIG = {
|
||||||
"dsn": os.environ.get("SENTRY_DSN"),
|
"dsn": os.environ.get("SENTRY_DSN"),
|
||||||
|
|
|
||||||
|
|
@ -57,8 +57,6 @@ REDDIT_REDIRECT_URL = os.environ.get("REDDIT_CALLBACK_URL", "")
|
||||||
# Third party settings
|
# Third party settings
|
||||||
AXES_HANDLER = "axes.handlers.database.AxesDatabaseHandler"
|
AXES_HANDLER = "axes.handlers.database.AxesDatabaseHandler"
|
||||||
|
|
||||||
REGISTRATION_OPEN = False
|
|
||||||
|
|
||||||
# Optionally use sentry integration
|
# Optionally use sentry integration
|
||||||
try:
|
try:
|
||||||
from sentry_sdk import init as sentry_init
|
from sentry_sdk import init as sentry_init
|
||||||
|
|
|
||||||
|
|
@ -1,17 +1,16 @@
|
||||||
<ol class="nav-list">
|
<ol class="nav-list">
|
||||||
{% if request.user.is_authenticated %}
|
{% if request.user.is_authenticated %}
|
||||||
<li class="nav-list__item"><a href="{% url 'index' %}">Home</a></li>
|
<li class="nav-list__item"><a href="{% url 'index' %}">Home</a></li>
|
||||||
<li class="nav-list__item"><a href="{% url 'news:core:categories' %}">Categories</a></li>
|
<li class="nav-list__item"><a href="{% url 'news:core:categories' %}">Categories</a></li>
|
||||||
<li class="nav-list__item"><a href="{% url 'news:collection:rules' %}">Sources</a></li>
|
<li class="nav-list__item"><a href="{% url 'news:collection:rules' %}">Sources</a></li>
|
||||||
<li class="nav-list__item"><a href="{% url 'accounts:settings:home' %}">Settings</a></li>
|
<li class="nav-list__item"><a href="{% url 'accounts:settings:home' %}">Settings</a></li>
|
||||||
|
|
||||||
{% if request.user.is_superuser %}
|
{% if request.user.is_superuser %}
|
||||||
<li class="nav-list__item"><a href="{% url 'admin:index' %}">Admin</a></li>
|
<li class="nav-list__item"><a href="{% url 'admin:index' %}">Admin</a></li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<li class="nav-list__item"><a href="{% url 'accounts:logout' %}">Logout</a></li>
|
<li class="nav-list__item"><a href="{% url 'accounts:logout' %}">Logout</a></li>
|
||||||
{% else %}
|
{% else %}
|
||||||
<li class="nav-list__item"><a href="{% url 'accounts:login' %}">Login</a></li>
|
<li class="nav-list__item"><a href="{% url 'accounts:login' %}">Login</a></li>
|
||||||
<li class="nav-list__item"><a href="{% url 'accounts:register' %}">Register</a></li>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</ol>
|
</ol>
|
||||||
|
|
|
||||||
|
|
@ -1,26 +0,0 @@
|
||||||
{% extends "sidebar.html" %}
|
|
||||||
{% load i18n %}
|
|
||||||
|
|
||||||
{% comment %}
|
|
||||||
**registration/activation_complete.html**
|
|
||||||
|
|
||||||
Used after successful account activation. This template has no context
|
|
||||||
variables of its own, and should simply inform the user that their
|
|
||||||
account is now active.
|
|
||||||
{% endcomment %}
|
|
||||||
|
|
||||||
{% block content %}
|
|
||||||
{% trans "Account activated" as header_text %}
|
|
||||||
|
|
||||||
{% if user.is_authenticated %}
|
|
||||||
{% trans "Your account is activated. You can now log in." as content %}
|
|
||||||
{% else %}
|
|
||||||
{% trans "Your account is activated." as content %}
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
<main class="main" data-render-sidebar=true>
|
|
||||||
<div class="main__container">
|
|
||||||
{% include "components/card/card.html" with header_text=header_text content=content %}
|
|
||||||
</div>
|
|
||||||
</main>
|
|
||||||
{% endblock %}
|
|
||||||
|
|
@ -1,72 +0,0 @@
|
||||||
{% load i18n %}
|
|
||||||
<!doctype html>
|
|
||||||
<html lang="en">
|
|
||||||
|
|
||||||
<head>
|
|
||||||
<title>{{ site.name }} {% trans "registration" %}</title>
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body>
|
|
||||||
<p>
|
|
||||||
{% blocktrans with site_name=site.name %}
|
|
||||||
You (or someone pretending to be you) have asked to register an account at
|
|
||||||
{{ site_name }}. If this wasn't you, please ignore this email
|
|
||||||
and your address will be removed from our records.
|
|
||||||
{% endblocktrans %}
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
{% blocktrans %}
|
|
||||||
To activate this account, please click the following link within the next
|
|
||||||
{{ expiration_days }} days:
|
|
||||||
{% endblocktrans %}
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
<a href="http://{{site.domain}}{% url 'accounts:activate' activation_key %}">
|
|
||||||
{{site.domain}}{% url 'accounts:activate' activation_key %}
|
|
||||||
</a>
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
{% blocktrans with site_name=site.name %}
|
|
||||||
Sincerely,
|
|
||||||
{{ site_name }} Management
|
|
||||||
{% endblocktrans %}
|
|
||||||
</p>
|
|
||||||
</body>
|
|
||||||
|
|
||||||
</html>
|
|
||||||
|
|
||||||
|
|
||||||
{% comment %}
|
|
||||||
**registration/activation_email.html**
|
|
||||||
|
|
||||||
Used to generate the html body of the activation email. Should display a
|
|
||||||
link the user can click to activate the account. This template has the
|
|
||||||
following context:
|
|
||||||
|
|
||||||
``activation_key``
|
|
||||||
The activation key for the new account.
|
|
||||||
|
|
||||||
``expiration_days``
|
|
||||||
The number of days remaining during which the account may be
|
|
||||||
activated.
|
|
||||||
|
|
||||||
``site``
|
|
||||||
An object representing the site on which the user registered;
|
|
||||||
depending on whether ``django.contrib.sites`` is installed, this
|
|
||||||
may be an instance of either ``django.contrib.sites.models.Site``
|
|
||||||
(if the sites application is installed) or
|
|
||||||
``django.contrib.sites.requests.RequestSite`` (if not). Consult `the
|
|
||||||
documentation for the Django sites framework
|
|
||||||
<http://docs.djangoproject.com/en/dev/ref/contrib/sites/>`_ for
|
|
||||||
details regarding these objects' interfaces.
|
|
||||||
|
|
||||||
``user``
|
|
||||||
The new user account
|
|
||||||
|
|
||||||
``request``
|
|
||||||
``HttpRequest`` instance for better flexibility.
|
|
||||||
For example it can be used to compute absolute register URL:
|
|
||||||
|
|
||||||
{{ request.scheme }}://{{ request.get_host }}{% url 'accounts:activate' activation_key %}
|
|
||||||
{% endcomment %}
|
|
||||||
|
|
@ -1,52 +0,0 @@
|
||||||
{% load i18n %}
|
|
||||||
{% blocktrans with site_name=site.name %}
|
|
||||||
You (or someone pretending to be you) have asked to register an account at
|
|
||||||
{{ site_name }}. If this wasn't you, please ignore this email
|
|
||||||
and your address will be removed from our records.
|
|
||||||
{% endblocktrans %}
|
|
||||||
{% blocktrans %}
|
|
||||||
To activate this account, please click the following link within the next
|
|
||||||
{{ expiration_days }} days:
|
|
||||||
{% endblocktrans %}
|
|
||||||
|
|
||||||
http://{{site.domain}}{% url 'accounts:activate' activation_key %}
|
|
||||||
|
|
||||||
{% blocktrans with site_name=site.name %}
|
|
||||||
Sincerely,
|
|
||||||
{{ site_name }} Management
|
|
||||||
{% endblocktrans %}
|
|
||||||
|
|
||||||
|
|
||||||
{% comment %}
|
|
||||||
**registration/activation_email.txt**
|
|
||||||
|
|
||||||
Used to generate the text body of the activation email. Should display a
|
|
||||||
link the user can click to activate the account. This template has the
|
|
||||||
following context:
|
|
||||||
|
|
||||||
``activation_key``
|
|
||||||
The activation key for the new account.
|
|
||||||
|
|
||||||
``expiration_days``
|
|
||||||
The number of days remaining during which the account may be
|
|
||||||
activated.
|
|
||||||
|
|
||||||
``site``
|
|
||||||
An object representing the site on which the user registered;
|
|
||||||
depending on whether ``django.contrib.sites`` is installed, this
|
|
||||||
may be an instance of either ``django.contrib.sites.models.Site``
|
|
||||||
(if the sites application is installed) or
|
|
||||||
``django.contrib.sites.requests.RequestSite`` (if not). Consult `the
|
|
||||||
documentation for the Django sites framework
|
|
||||||
<http://docs.djangoproject.com/en/dev/ref/contrib/sites/>`_ for
|
|
||||||
details regarding these objects' interfaces.
|
|
||||||
|
|
||||||
``user``
|
|
||||||
The new user account
|
|
||||||
|
|
||||||
``request``
|
|
||||||
``HttpRequest`` instance for better flexibility.
|
|
||||||
For example it can be used to compute absolute register URL:
|
|
||||||
|
|
||||||
{{ request.scheme }}://{{ request.get_host }}{% url 'accounts:activate' activation_key %}
|
|
||||||
{% endcomment %}
|
|
||||||
|
|
@ -1,28 +0,0 @@
|
||||||
{% load i18n %}{% trans "Account activation on" %} {{ site.name }}
|
|
||||||
|
|
||||||
|
|
||||||
{% comment %}
|
|
||||||
**registration/activation_email_subject.txt**
|
|
||||||
|
|
||||||
Used to generate the subject line of the activation email. Because the
|
|
||||||
subject line of an email must be a single line of text, any output
|
|
||||||
from this template will be forcibly condensed to a single line before
|
|
||||||
being used. This template has the following context:
|
|
||||||
|
|
||||||
``activation_key``
|
|
||||||
The activation key for the new account.
|
|
||||||
|
|
||||||
``expiration_days``
|
|
||||||
The number of days remaining during which the account may be
|
|
||||||
activated.
|
|
||||||
|
|
||||||
``site``
|
|
||||||
An object representing the site on which the user registered;
|
|
||||||
depending on whether ``django.contrib.sites`` is installed, this
|
|
||||||
may be an instance of either ``django.contrib.sites.models.Site``
|
|
||||||
(if the sites application is installed) or
|
|
||||||
``django.contrib.sites.requests.RequestSite`` (if not). Consult `the
|
|
||||||
documentation for the Django sites framework
|
|
||||||
<http://docs.djangoproject.com/en/dev/ref/contrib/sites/>`_ for
|
|
||||||
details regarding these objects' interfaces.
|
|
||||||
{% endcomment %}
|
|
||||||
|
|
@ -1,22 +0,0 @@
|
||||||
{% extends "sidebar.html" %}
|
|
||||||
{% load i18n %}
|
|
||||||
|
|
||||||
{% comment %}
|
|
||||||
**registration/activate.html**
|
|
||||||
|
|
||||||
Used if account activation fails. With the default setup, has the following context:
|
|
||||||
|
|
||||||
``activation_key``
|
|
||||||
The activation key used during the activation attempt.
|
|
||||||
{% endcomment %}
|
|
||||||
|
|
||||||
{% block content %}
|
|
||||||
{% trans "Activation Failure" as header_text %}
|
|
||||||
{% trans "Account activation failed." as content %}
|
|
||||||
|
|
||||||
<main class="main" data-render-sidebar=true>
|
|
||||||
<div class="main__container">
|
|
||||||
{% include "components/card/card.html" with header_text=header_text content=content %}
|
|
||||||
</div>
|
|
||||||
</main>
|
|
||||||
{% endblock %}
|
|
||||||
|
|
@ -1,23 +0,0 @@
|
||||||
{% extends "base.html" %}
|
|
||||||
{% load static i18n %}
|
|
||||||
|
|
||||||
{% block title %}{% trans "Account Activation Resent" %}{% endblock %}
|
|
||||||
|
|
||||||
{% comment %}
|
|
||||||
**registration/resend_activation_complete.html**
|
|
||||||
Used after form for resending account activation is submitted. By default has
|
|
||||||
the following context:
|
|
||||||
|
|
||||||
``email``
|
|
||||||
The email address submitted in the resend activation form.
|
|
||||||
{% endcomment %}
|
|
||||||
|
|
||||||
{% block content %}
|
|
||||||
<main class="main">
|
|
||||||
{% trans "Account activation resent" as header_text %}
|
|
||||||
{% blocktrans asvar content %}
|
|
||||||
We have sent an email to {{ email }} with further instructions.
|
|
||||||
{% endblocktrans %}
|
|
||||||
{% include "components/card/card.html" with header_text=header_text content=content %}
|
|
||||||
</main>
|
|
||||||
{% endblock %}
|
|
||||||
|
|
@ -1,12 +0,0 @@
|
||||||
{% extends "sidebar.html" %}
|
|
||||||
{% load static %}
|
|
||||||
|
|
||||||
{% block content %}
|
|
||||||
{% url "accounts:login" as cancel_url %}
|
|
||||||
|
|
||||||
<main class="main" data-render-sidebar=true>
|
|
||||||
<div class="main__container">
|
|
||||||
{% include "components/form/form.html" with form=form title="Resend activation code" cancel_url=cancel_url confirm_text="Resend code" %}
|
|
||||||
</div>
|
|
||||||
</main>
|
|
||||||
{% endblock %}
|
|
||||||
|
|
@ -1,13 +0,0 @@
|
||||||
{% extends "sidebar.html" %}
|
|
||||||
{% load static i18n %}
|
|
||||||
|
|
||||||
{% block content %}
|
|
||||||
{% trans "Registration is closed" as header_text %}
|
|
||||||
{% trans "Sorry, but registration is closed at this moment. Come back later." as content %}
|
|
||||||
|
|
||||||
<main class="main" data-render-sidebar=true>
|
|
||||||
<div class="main__container">
|
|
||||||
{% include "components/card/card.html" with header_text=header_text content=content %}
|
|
||||||
</div>
|
|
||||||
</main>
|
|
||||||
{% endblock %}
|
|
||||||
|
|
@ -1,22 +0,0 @@
|
||||||
{% extends "sidebar.html" %}
|
|
||||||
{% load i18n %}
|
|
||||||
|
|
||||||
{% comment %}
|
|
||||||
**registration/registration_complete.html**
|
|
||||||
|
|
||||||
Used after successful completion of the registration form. This
|
|
||||||
template has no context variables of its own, and should simply inform
|
|
||||||
the user that an email containing account-activation information has
|
|
||||||
been sent.
|
|
||||||
{% endcomment %}
|
|
||||||
|
|
||||||
{% block content %}
|
|
||||||
{% trans "Activation email sent" as header_text %}
|
|
||||||
{% trans "Please check your email to complete the registration process." as content %}
|
|
||||||
|
|
||||||
<main class="main" data-render-sidebar=true>
|
|
||||||
<div class="main__container">
|
|
||||||
{% include "components/card/card.html" with header_text=header_text content=content %}
|
|
||||||
</div>
|
|
||||||
</main>
|
|
||||||
{% endblock %}
|
|
||||||
|
|
@ -1,13 +0,0 @@
|
||||||
{% extends "sidebar.html" %}
|
|
||||||
{% load static %}
|
|
||||||
|
|
||||||
|
|
||||||
{% block content %}
|
|
||||||
{% url "accounts:login" as cancel_url %}
|
|
||||||
|
|
||||||
<main class="main" data-render-sidebar=true>
|
|
||||||
<div class="main__container">
|
|
||||||
{% include "components/form/form.html" with form=form title="Register" cancel_url=cancel_url confirm_text="Register" %}
|
|
||||||
</div>
|
|
||||||
</main>
|
|
||||||
{% endblock %}
|
|
||||||
|
|
@ -21,7 +21,6 @@ class NavListMixin(ContextMixin):
|
||||||
|
|
||||||
unauthenticated_links = {
|
unauthenticated_links = {
|
||||||
"Login": reverse("accounts:login"),
|
"Login": reverse("accounts:login"),
|
||||||
"Register": reverse("accounts:register"),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if self.request.user.is_authenticated:
|
if self.request.user.is_authenticated:
|
||||||
|
|
|
||||||
11
uv.lock
generated
11
uv.lock
generated
|
|
@ -276,15 +276,6 @@ wheels = [
|
||||||
{ url = "https://files.pythonhosted.org/packages/a7/7e/ba12b9660642663f5273141018d2bec0a1cae1711f4f6d1093920e157946/django_extensions-3.2.3-py3-none-any.whl", hash = "sha256:9600b7562f79a92cbf1fde6403c04fee314608fefbb595502e34383ae8203401", size = 229868 },
|
{ url = "https://files.pythonhosted.org/packages/a7/7e/ba12b9660642663f5273141018d2bec0a1cae1711f4f6d1093920e157946/django_extensions-3.2.3-py3-none-any.whl", hash = "sha256:9600b7562f79a92cbf1fde6403c04fee314608fefbb595502e34383ae8203401", size = 229868 },
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "django-registration-redux"
|
|
||||||
version = "2.13"
|
|
||||||
source = { registry = "https://pypi.org/simple" }
|
|
||||||
sdist = { url = "https://files.pythonhosted.org/packages/f6/47/960fb3f88d0080a94fffb6fc98ff986012d3a968c030036cf79abdd40242/django-registration-redux-2.13.tar.gz", hash = "sha256:9793a05b32b1d7342c6ef3e0140b2951b7dbde058b3ba6e8a232b534928279f9", size = 125883 }
|
|
||||||
wheels = [
|
|
||||||
{ url = "https://files.pythonhosted.org/packages/32/7f/715af6a1322a1bc8fc84befa469a048dd5983eeac49f464ffa01bff33f00/django_registration_redux-2.13-py2.py3-none-any.whl", hash = "sha256:547c86ad9b951cf743075b5486f304e51e450b45d04e5ef04392838a9cff3da8", size = 218441 },
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "django-rest-framework"
|
name = "django-rest-framework"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
|
@ -505,7 +496,6 @@ dependencies = [
|
||||||
{ name = "django", marker = "sys_platform == 'linux'" },
|
{ name = "django", marker = "sys_platform == 'linux'" },
|
||||||
{ name = "django-axes", marker = "sys_platform == 'linux'" },
|
{ name = "django-axes", marker = "sys_platform == 'linux'" },
|
||||||
{ name = "django-celery-beat", marker = "sys_platform == 'linux'" },
|
{ name = "django-celery-beat", marker = "sys_platform == 'linux'" },
|
||||||
{ name = "django-registration-redux", marker = "sys_platform == 'linux'" },
|
|
||||||
{ name = "django-rest-framework", marker = "sys_platform == 'linux'" },
|
{ name = "django-rest-framework", marker = "sys_platform == 'linux'" },
|
||||||
{ name = "djangorestframework-camel-case", marker = "sys_platform == 'linux'" },
|
{ name = "djangorestframework-camel-case", marker = "sys_platform == 'linux'" },
|
||||||
{ name = "feedparser", marker = "sys_platform == 'linux'" },
|
{ name = "feedparser", marker = "sys_platform == 'linux'" },
|
||||||
|
|
@ -549,7 +539,6 @@ requires-dist = [
|
||||||
{ name = "django", specifier = "~=4.2" },
|
{ name = "django", specifier = "~=4.2" },
|
||||||
{ name = "django-axes" },
|
{ name = "django-axes" },
|
||||||
{ name = "django-celery-beat", specifier = "~=2.7.0" },
|
{ name = "django-celery-beat", specifier = "~=2.7.0" },
|
||||||
{ name = "django-registration-redux", specifier = "~=2.7" },
|
|
||||||
{ name = "django-rest-framework" },
|
{ name = "django-rest-framework" },
|
||||||
{ name = "djangorestframework-camel-case" },
|
{ name = "djangorestframework-camel-case" },
|
||||||
{ name = "feedparser" },
|
{ name = "feedparser" },
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue