diff --git a/eva/urls.py b/eva/urls.py index 9417d51..d243e82 100644 --- a/eva/urls.py +++ b/eva/urls.py @@ -19,4 +19,5 @@ from django.urls import path, include urlpatterns = [ path('', include("evapp.urls")), path('admin/', admin.site.urls), + path('accounts/', include('django.contrib.auth.urls')), ] diff --git a/evapp/templates/registration/login.html b/evapp/templates/registration/login.html new file mode 100644 index 0000000..cbceed1 --- /dev/null +++ b/evapp/templates/registration/login.html @@ -0,0 +1,35 @@ +{% block content %} + + {% if form.errors %} +
Your username and password didn't match. Please try again.
+ {% endif %} + + {% if next %} + {% if user.is_authenticated %} +Your account doesn't have access to this page. To proceed, + please login with an account that has access.
+ {% else %} +Please login to see this page.
+ {% endif %} + {% endif %} + + + + {# Assumes you setup the password_reset view in your URLconf #} + + +{% endblock %} diff --git a/evapp/views.py b/evapp/views.py index 1227fc6..9e4fd76 100644 --- a/evapp/views.py +++ b/evapp/views.py @@ -9,6 +9,7 @@ from django.template.loader import get_template from formtools.wizard.views import CookieWizardView from django.shortcuts import render from django.conf import settings +from django.contrib.auth.mixins import LoginRequiredMixin from .models import Employee, DEPARTMENT_CHOICES, LAPTOP_CHOICES, OS_CHOICES, VENDOR_CHOICES, \ MOBILE_CHOICES, LANG_CHOICES, ACCOUNT_CHOICES, TRANSPONDER_CHOICES @@ -43,7 +44,7 @@ def change_process(wizard): return not long_process(wizard) -class EvaFormView(CookieWizardView): +class EvaFormView(LoginRequiredMixin, CookieWizardView): template_name = 'evapp/employee_form.html' form_list = [PersonalForm, WorkingForm, ITForm, OfficeForm, ChangeForm, DummyForm] instance = None