From 535971333d340a3abc2d83e9dff74fdbf7aa99aa Mon Sep 17 00:00:00 2001 From: Johannes Erwerle Date: Sat, 3 Oct 2026 09:13:39 +0200 Subject: [PATCH] Added custom HTML code for password change views. Closes #3 --- community_backup/community_backup/urls.py | 15 ++++++++++++++- .../registration/password_change_done.html | 11 +++++++++++ .../registration/password_change_form.html | 17 +++++++++++++++++ 3 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 community_backup/webui/templates/registration/password_change_done.html create mode 100644 community_backup/webui/templates/registration/password_change_form.html diff --git a/community_backup/community_backup/urls.py b/community_backup/community_backup/urls.py index f8b5762..256fd45 100644 --- a/community_backup/community_backup/urls.py +++ b/community_backup/community_backup/urls.py @@ -17,9 +17,22 @@ Including another URLconf from django.contrib import admin from django.urls import path, include +from django.contrib.auth import views as auth_views urlpatterns = [ path("", include("webui.urls")), path("admin/", admin.site.urls), - path("accounts/", include("django.contrib.auth.urls")) + # only import the views from the auth package that we actually use + path("accounts/login/", auth_views.LoginView.as_view(), name="login"), + path("accounts/logout/", auth_views.LogoutView.as_view(), name="logout"), + path( + "accounts/password_change/", + auth_views.PasswordChangeView.as_view(), + name="password_change", + ), + path( + "accounts/password_change/done/", + auth_views.PasswordChangeDoneView.as_view(), + name="password_change_done", + ), ] diff --git a/community_backup/webui/templates/registration/password_change_done.html b/community_backup/webui/templates/registration/password_change_done.html new file mode 100644 index 0000000..43f3869 --- /dev/null +++ b/community_backup/webui/templates/registration/password_change_done.html @@ -0,0 +1,11 @@ +{% extends "base.html" %} + +{% block content %} + +

Password change successful

+ +
+ Your password was changed successfully. +
+ +{% endblock %} diff --git a/community_backup/webui/templates/registration/password_change_form.html b/community_backup/webui/templates/registration/password_change_form.html new file mode 100644 index 0000000..e654f6a --- /dev/null +++ b/community_backup/webui/templates/registration/password_change_form.html @@ -0,0 +1,17 @@ +{% extends "base.html" %} +{% load crispy_forms_tags %} + +{% block content %} + +

Change your password

+ +
+ +
+ {% csrf_token %} + {{ form|crispy }} + +
+
+ +{% endblock %}