Add login/logout links and templates
This commit is contained in:
parent
bff06c1de2
commit
c96bd0d0db
3 changed files with 77 additions and 6 deletions
|
|
@ -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/<int:pk>/', views.DomaineDetailView.as_view(), name='domaine-detail'),
|
||||
|
|
|
|||
|
|
@ -9,9 +9,9 @@
|
|||
<div id="user-tools">
|
||||
{% if user.is_authenticated %}
|
||||
{% block welcome-msg %}Bienvenue <strong>{% firstof user.username %}</strong>.{% endblock %}
|
||||
<a href="{% url 'home' %}">Site public</a> <a href="{% url 'admin:index' %}">Admin</a>
|
||||
<a href="{% url 'logout' %}">Déconnexion</a>
|
||||
{% else %}
|
||||
<a href="{% url 'admin:index' %}">Admin</a>
|
||||
<a href="{% url 'login' %}?next={{ request.path }}">Connexion</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
|
|
|||
67
templates/registration/login.html
Normal file
67
templates/registration/login.html
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
{% extends "cms/base_site.html" %}
|
||||
{% load i18n static %}
|
||||
|
||||
{% block extrastyle %}{{ block.super }}
|
||||
<link rel="stylesheet" type="text/css" href="{% static 'admin/css/login.css' %}" />
|
||||
{{ 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 %}
|
||||
<p class="errornote">
|
||||
{% if form.errors.items|length == 1 %}{% trans "Please correct the error below." %}{% else %}{% trans "Please correct the errors below." %}{% endif %}
|
||||
</p>
|
||||
{% endif %}
|
||||
|
||||
{% if form.non_field_errors %}
|
||||
{% for error in form.non_field_errors %}
|
||||
<p class="errornote">
|
||||
{{ error }}
|
||||
</p>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
<div id="content-main">
|
||||
|
||||
{% if user.is_authenticated %}
|
||||
<p class="errornote">
|
||||
{% 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 %}
|
||||
</p>
|
||||
{% endif %}
|
||||
|
||||
<form action="{{ app_path }}" method="post" id="login-form">{% csrf_token %}
|
||||
<div class="form-row">
|
||||
{{ form.username.errors }}
|
||||
{{ form.username.label_tag }} {{ form.username }}
|
||||
</div>
|
||||
<div class="form-row">
|
||||
{{ form.password.errors }}
|
||||
{{ form.password.label_tag }} {{ form.password }}
|
||||
<input type="hidden" name="next" value="{{ next }}" />
|
||||
</div>
|
||||
{% url 'admin_password_reset' as password_reset_url %}
|
||||
{% if password_reset_url %}
|
||||
<div class="password-reset-link">
|
||||
<a href="{{ password_reset_url }}">{% trans 'Forgotten your password or username?' %}</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="submit-row">
|
||||
<label> </label><input type="submit" value="{% trans 'Log in' %}" />
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
{% endblock %}
|
||||
Loading…
Add table
Add a link
Reference in a new issue