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 + + + + + +
+ +
+
+
+ +
+ +
+

{% trans "Password reset complete" %}

+

{% trans "Return to login screen" %}

+
+
+
+
+ +
+ + \ 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 + + + + + +
+ +
+
+
+ +
+ +
+ + {% if validlink %} +

{% trans "Change password" %}

+
+ {% csrf_token %} + {{ form.as_p }} + +
+ {% else %} +

+ {% trans "The password reset link was invalid, possibly because it has already been used. Please request a new password reset." %} +

+ {% endif %} +
+
+
+
+
+ + \ 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 + + + + + +
+ +
+
+
+ +
+
+ +

+ {% trans "We've emailed you instructions for setting your password, if an account exists with the email you entered. You should receive them shortly." %} +

+

+ {% trans "If you don't receive an email, please make sure you've entered the address you registered with, and check your spam folder." %} +

+ +
+ {% trans "Return to login screen" %} +
+
+
+
+
+ + \ 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 + + + + + +
+ +
+
+
+ +
+ +
+ +

{% trans "Forgotten your password?" %}

+

{% trans "Enter your email address below." %}

+

{% trans "An email will be sent with password reset instructions." %}

+ +
+ {% csrf_token %} + {{ form.as_p }} + +
+ +
+
+
+
+ +
+ + \ No newline at end of file