Setup basic auth
This commit is contained in:
parent
3294ef2a82
commit
d7545ab43c
17 changed files with 315 additions and 4 deletions
36
base/templates/base.html
Normal file
36
base/templates/base.html
Normal file
|
@ -0,0 +1,36 @@
|
|||
{% load static %}
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>{% block title %}Musik{% endblock %}</title>
|
||||
|
||||
<link rel="stylesheet" href="{% static "css/main.css" %}">
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@picocss/pico@2/css/pico.purple.min.css">
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/remixicon@4.6.0/fonts/remixicon.min.css">
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<div class="container">
|
||||
<a href="{% url 'index' %}">
|
||||
<img class="logo" src="{% static "logo.svg" %}" height="64" width="64" alt="Musik">
|
||||
</a>
|
||||
<nav>
|
||||
<ul>
|
||||
{% if user.is_authenticated %}
|
||||
<li>{{ user.username }}</li>
|
||||
<li><form action="{% url 'logout' %}" method="post">{% csrf_token %}<input type="submit" value="Se déconnecter" class="logout"></form></li>
|
||||
{% else %}
|
||||
<li><a href="{% url 'login' %}" role="button">Se connecter <i class="ri-login-box-fill"></i></a></li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</header>
|
||||
<main class="container">
|
||||
{% block content %}
|
||||
{% endblock content %}
|
||||
</main>
|
||||
</body>
|
||||
</html>
|
27
base/templates/base/form.html
Normal file
27
base/templates/base/form.html
Normal file
|
@ -0,0 +1,27 @@
|
|||
{% if form.non_field_errors %}
|
||||
<ul class="form-errors">
|
||||
{% for error in form.non_field_errors %}
|
||||
<li>{{ error }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
|
||||
<form method="post" action="{% url "login" %}">
|
||||
{% csrf_token %}
|
||||
<fieldset>
|
||||
{% for field in form %}
|
||||
<label>
|
||||
{{ field.label }}
|
||||
{{ field }}
|
||||
</label>
|
||||
{% if field.errors %}
|
||||
<ul class="form-errors">
|
||||
{% for error in field.errors %}
|
||||
<li>{{ error }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</fieldset>
|
||||
<input type="submit" {% if submit %}value="{{ submit }}"{% endif %}>
|
||||
</form>
|
5
base/templates/index.html
Normal file
5
base/templates/index.html
Normal file
|
@ -0,0 +1,5 @@
|
|||
{% extends "base.html" %}
|
||||
|
||||
{% block content %}
|
||||
<h1>Musik</h1>
|
||||
{% endblock content %}
|
7
base/templates/registration/login.html
Normal file
7
base/templates/registration/login.html
Normal file
|
@ -0,0 +1,7 @@
|
|||
{% extends "base.html" %}
|
||||
{% load form %}
|
||||
|
||||
{% block content %}
|
||||
<h1>Connexion</h1>
|
||||
{% form form submit="Se connecter" %}
|
||||
{% endblock content %}
|
Loading…
Add table
Add a link
Reference in a new issue