From 12a4c22a9b28b1924e396f265f443edfe13e1d72 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Mon, 12 Apr 2021 20:02:05 +1000 Subject: [PATCH] Password reset templates --- InvenTree/InvenTree/middleware.py | 4 ++ InvenTree/InvenTree/urls.py | 1 + InvenTree/templates/registration/login.html | 2 + .../registration/password_reset_complete.html | 59 ++++++++++++++++ .../registration/password_reset_confirm.html | 69 +++++++++++++++++++ .../registration/password_reset_done.html | 65 +++++++++++++++++ .../registration/password_reset_form.html | 68 ++++++++++++++++++ 7 files changed, 268 insertions(+) create mode 100644 InvenTree/templates/registration/password_reset_complete.html create mode 100644 InvenTree/templates/registration/password_reset_confirm.html create mode 100644 InvenTree/templates/registration/password_reset_done.html create mode 100644 InvenTree/templates/registration/password_reset_form.html diff --git a/InvenTree/InvenTree/middleware.py b/InvenTree/InvenTree/middleware.py index a34df4b7bd..f30d77ad3b 100644 --- a/InvenTree/InvenTree/middleware.py +++ b/InvenTree/InvenTree/middleware.py @@ -52,6 +52,10 @@ class AuthRequiredMiddleware(object): if request.path_info.startswith('/static/'): authorized = True + # Unauthorized users can access the login page + elif request.path_info.startswith('/accounts/'): + authorized = True + elif 'Authorization' in request.headers.keys(): auth = request.headers['Authorization'].strip() diff --git a/InvenTree/InvenTree/urls.py b/InvenTree/InvenTree/urls.py index 7c22639e65..28854e311d 100644 --- a/InvenTree/InvenTree/urls.py +++ b/InvenTree/InvenTree/urls.py @@ -143,6 +143,7 @@ urlpatterns = [ url(r'^admin/error_log/', include('error_report.urls')), url(r'^admin/shell/', include('django_admin_shell.urls')), url(r'^admin/', admin.site.urls, name='inventree-admin'), + url(r'accounts/', include('django.contrib.auth.urls')), url(r'^index/', IndexView.as_view(), name='index'), url(r'^search/', SearchView.as_view(), name='search'), diff --git a/InvenTree/templates/registration/login.html b/InvenTree/templates/registration/login.html index a3f7b91e35..746d3c86fa 100644 --- a/InvenTree/templates/registration/login.html +++ b/InvenTree/templates/registration/login.html @@ -89,6 +89,8 @@ +

+

{% trans "Forgotten your password?" %} - {% trans "Click here to reset" %}

diff --git a/InvenTree/templates/registration/password_reset_complete.html b/InvenTree/templates/registration/password_reset_complete.html new file mode 100644 index 0000000000..7fc83d85ba --- /dev/null +++ b/InvenTree/templates/registration/password_reset_complete.html @@ -0,0 +1,59 @@ +{% load static %} +{% load i18n %} +{% load crispy_forms_tags %} + + + + + + + + + + + + + + + + + + + + + + + + + InvenTree + + + + + +
+ + + +
+ + \ No newline at end of file diff --git a/InvenTree/templates/registration/password_reset_confirm.html b/InvenTree/templates/registration/password_reset_confirm.html new file mode 100644 index 0000000000..455baea698 --- /dev/null +++ b/InvenTree/templates/registration/password_reset_confirm.html @@ -0,0 +1,69 @@ +{% load static %} +{% load i18n %} +{% load crispy_forms_tags %} + + + + + + + + + + + + + + + + + + + + + + + + + InvenTree + + + + + +
+ + +
+ + \ No newline at end of file diff --git a/InvenTree/templates/registration/password_reset_done.html b/InvenTree/templates/registration/password_reset_done.html new file mode 100644 index 0000000000..04e0aec69b --- /dev/null +++ b/InvenTree/templates/registration/password_reset_done.html @@ -0,0 +1,65 @@ +{% load static %} +{% load i18n %} +{% load crispy_forms_tags %} + + + + + + + + + + + + + + + + + + + + + + + + + InvenTree + + + + + +
+ + +
+ + \ No newline at end of file diff --git a/InvenTree/templates/registration/password_reset_form.html b/InvenTree/templates/registration/password_reset_form.html new file mode 100644 index 0000000000..dabada5651 --- /dev/null +++ b/InvenTree/templates/registration/password_reset_form.html @@ -0,0 +1,68 @@ +{% load static %} +{% load i18n %} +{% load crispy_forms_tags %} + + + + + + + + + + + + + + + + + + + + + + + + + InvenTree + + + + + +
+ + + +
+ + \ No newline at end of file