Add a login page

This commit is contained in:
Gabriel Augendre 2019-03-02 15:49:05 +01:00
parent 956349ea58
commit b2c6051bd3
5 changed files with 28 additions and 7 deletions

View file

@ -6,6 +6,7 @@ name = "pypi"
[packages]
django = "*"
gitpython = "*"
django-crispy-forms = "*"
[dev-packages]

10
Pipfile.lock generated
View file

@ -1,7 +1,7 @@
{
"_meta": {
"hash": {
"sha256": "8f5375aad28234aa513d8d0b3921e77eded8dcb11a81afcebae00a618d4aec94"
"sha256": "a641d67a7e9f7c8b91008ec1d74563f65757dd900d38c5901f7fa3a450dc2be4"
},
"pipfile-spec": 6,
"requires": {
@ -24,6 +24,14 @@
"index": "pypi",
"version": "==2.1.7"
},
"django-crispy-forms": {
"hashes": [
"sha256:5952bab971110d0b86c278132dae0aa095beee8f723e625c3d3fa28888f1675f",
"sha256:705ededc554ad8736157c666681165fe22ead2dec0d5446d65fc9dd976a5a876"
],
"index": "pypi",
"version": "==1.7.2"
},
"gitdb2": {
"hashes": [
"sha256:83361131a1836661a155172932a13c08bda2db3674e4caa32368aa6eb02f38c2",

View file

@ -38,6 +38,7 @@ INSTALLED_APPS = [
'django.contrib.messages',
'django.contrib.staticfiles',
'map',
'crispy_forms',
]
MIDDLEWARE = [
@ -142,4 +143,5 @@ APP = {
},
}
CRISPY_TEMPLATE_PACK = 'bootstrap4'

View file

@ -11,8 +11,8 @@
<li class="nav-item">
<a class="nav-link" href="{{ git_version.url }}">Version : {{ git_version.name }}</a>
</li>
{% if user.is_authenticated %}
<li class="nav-item dropdown">
{% if user.is_authenticated %}
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button"
data-toggle="dropdown"
aria-haspopup="true" aria-expanded="false">
@ -27,10 +27,10 @@
<div role="separator" class="dropdown-divider"></div>
<a class="dropdown-item" href="{% url 'logout' %}">Déconnexion</a>
</div>
</li>
{% else %}
<li class="navbar-text">Anonyme</li>
<a class="nav-link" href="{% url 'login' %}?next={% url 'map' %}">Login</a>
{% endif %}
</li>
</ul>
</div>
</div>

View file

@ -0,0 +1,10 @@
{% extends 'map/base.html' %}
{% load crispy_forms_tags %}
{% block content %}
<form method="post">
{% csrf_token %}
{{ form|crispy }}
<button type="submit" class="btn btn-primary">Login</button>
</form>
{% endblock %}