diff --git a/common/urls.py b/common/urls.py index f92c020..99208da 100644 --- a/common/urls.py +++ b/common/urls.py @@ -1,16 +1,20 @@ -"""eds URL Configuration - +""" +eds URL Configuration """ import os -from django.urls import path, include -from django.contrib import admin + from django.conf import settings +from django.contrib import admin +from django.contrib.auth.views import LoginView, LogoutView +from django.urls import path, include from django.views.static import serve from cms import views urlpatterns = [ path('', views.HomeView.as_view(), name='home'), + path('login/', LoginView.as_view(), name='login'), + path('logout/', LogoutView.as_view(next_page='/'), name='logout'), path('plan_pdf/', views.print_plan_formation, name='plan-pdf'), path('admin/', admin.site.urls), path('domaine//', views.DomaineDetailView.as_view(), name='domaine-detail'), diff --git a/templates/cms/base_site.html b/templates/cms/base_site.html index 8b4ab2e..328d5aa 100644 --- a/templates/cms/base_site.html +++ b/templates/cms/base_site.html @@ -9,9 +9,9 @@
{% if user.is_authenticated %} {% block welcome-msg %}Bienvenue {% firstof user.username %}.{% endblock %} - Site public  Admin + Déconnexion {% else %} - Admin + Connexion {% endif %}
{% endblock %} diff --git a/templates/registration/login.html b/templates/registration/login.html new file mode 100644 index 0000000..916f2a0 --- /dev/null +++ b/templates/registration/login.html @@ -0,0 +1,67 @@ +{% extends "cms/base_site.html" %} +{% load i18n static %} + +{% block extrastyle %}{{ block.super }} + +{{ form.media }} +{% endblock %} + +{% block bodyclass %}login{% endblock %} + +{% block usertools %}{% endblock %} + +{% block nav-global %}{% endblock %} + +{% block content_title %}{% endblock %} + +{% block breadcrumbs %}{% endblock %} + +{% block content %} +{% if form.errors and not form.non_field_errors %} +

+{% if form.errors.items|length == 1 %}{% trans "Please correct the error below." %}{% else %}{% trans "Please correct the errors below." %}{% endif %} +

+{% endif %} + +{% if form.non_field_errors %} +{% for error in form.non_field_errors %} +

+ {{ error }} +

+{% endfor %} +{% endif %} + +
+ +{% if user.is_authenticated %} +

+{% blocktrans trimmed %} + You are authenticated as {{ username }}, but are not authorized to + access this page. Would you like to login to a different account? +{% endblocktrans %} +

+{% endif %} + +
{% csrf_token %} +
+ {{ form.username.errors }} + {{ form.username.label_tag }} {{ form.username }} +
+
+ {{ form.password.errors }} + {{ form.password.label_tag }} {{ form.password }} + +
+ {% url 'admin_password_reset' as password_reset_url %} + {% if password_reset_url %} + + {% endif %} +
+ +
+
+ +
+{% endblock %}