From 65319aae4ac730b373a4cfd759cf704bfb2b58ac Mon Sep 17 00:00:00 2001
From: Rushil Umaretiya
Date: Sun, 16 Apr 2023 10:11:47 -0500
Subject: [PATCH 1/2] auth: add maintainer info to index and lockout (#179)
---
tjdests/apps/authentication/views.py | 11 +++++++++++
tjdests/settings/__init__.py | 3 +++
tjdests/templates/authentication/index.html | 5 +++--
3 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/tjdests/apps/authentication/views.py b/tjdests/apps/authentication/views.py
index 26a6ac8..383177e 100644
--- a/tjdests/apps/authentication/views.py
+++ b/tjdests/apps/authentication/views.py
@@ -65,3 +65,14 @@ def accept_tos_view(request: HttpRequest) -> HttpResponse:
context = {"form": form}
return render(request, "authentication/accept_tos.html", context=context)
+
+
+def lockout(request, *args, **kwargs):
+ return HttpResponse(
+ (
+ "Your account has been locked due to too many failed login attempts, ",
+ f"please contact {settings.MAINTAINER} for assistance ",
+ "or remember your password next time!",
+ ),
+ status=403,
+ )
diff --git a/tjdests/settings/__init__.py b/tjdests/settings/__init__.py
index f5a9e06..cb6b098 100644
--- a/tjdests/settings/__init__.py
+++ b/tjdests/settings/__init__.py
@@ -124,6 +124,9 @@ AUTHENTICATION_BACKENDS = (
"django.contrib.auth.backends.ModelBackend",
)
+AXES_LOCKOUT_CALLABLE = "tjdests.apps.authentication.views.lockout"
+MAINTAINER = ""
+
SOCIAL_AUTH_REDIRECT_IS_HTTPS = False
SOCIAL_AUTH_ION_KEY = ""
SOCIAL_AUTH_ION_SECRET = ""
diff --git a/tjdests/templates/authentication/index.html b/tjdests/templates/authentication/index.html
index fa44280..1381709 100644
--- a/tjdests/templates/authentication/index.html
+++ b/tjdests/templates/authentication/index.html
@@ -30,8 +30,9 @@
This website is open source,
- and is © 2021 Ethan Nguyen and contributors.
- All rights reserved.
+ and is currently maintained by {{ settings.MAINTAINER }}
+ © 2021 Ethan Nguyen and contributors.
+ All rights reserved.
{% endblock %}
From 546e8d642f49d5fe7995b2f702510964e3014e91 Mon Sep 17 00:00:00 2001
From: Ethan Nguyen
Date: Sun, 16 Apr 2023 18:15:15 -0500
Subject: [PATCH 2/2] feat(auth/index): copyright date to present
---
tjdests/templates/authentication/index.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tjdests/templates/authentication/index.html b/tjdests/templates/authentication/index.html
index 1381709..a24ed93 100644
--- a/tjdests/templates/authentication/index.html
+++ b/tjdests/templates/authentication/index.html
@@ -31,7 +31,7 @@
This website is open source,
and is currently maintained by {{ settings.MAINTAINER }}
- © 2021 Ethan Nguyen and contributors.
+ © 2021-{% now "Y" %} Ethan Nguyen and contributors.
All rights reserved.