Vraie page de connexion app (non-staff) + deconnexion
This commit is contained in:
@@ -55,7 +55,11 @@
|
|||||||
<a class="{% if vue == 'tva' %}on{% endif %}" href="/declaration/tva/?entreprise={{ entreprise.pk }}&annee={{ annee }}">Déclaration TVA</a>
|
<a class="{% if vue == 'tva' %}on{% endif %}" href="/declaration/tva/?entreprise={{ entreprise.pk }}&annee={{ annee }}">Déclaration TVA</a>
|
||||||
<a class="saisie" href="/saisie/">+ Saisir</a>
|
<a class="saisie" href="/saisie/">+ Saisir</a>
|
||||||
<a href="/import/">Importer</a>
|
<a href="/import/">Importer</a>
|
||||||
<a href="/admin/">Admin</a>
|
{% if user.is_staff %}<a href="/admin/">Admin</a>{% endif %}
|
||||||
|
<form method="post" action="/logout/" style="display:inline;margin:0;">
|
||||||
|
{% csrf_token %}
|
||||||
|
<button type="submit" style="background:var(--card);color:var(--txt);border:1px solid #334155;border-radius:8px;padding:7px 13px;font-size:14px;cursor:pointer;">Déconnexion</button>
|
||||||
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h1>{{ entreprise.nom }}</h1>
|
<h1>{{ entreprise.nom }}</h1>
|
||||||
|
|||||||
@@ -0,0 +1,42 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="fr">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
<title>JB Compta — Connexion</title>
|
||||||
|
<style>
|
||||||
|
:root { --bg:#0f172a; --card:#1e293b; --txt:#e2e8f0; --muted:#94a3b8; --accent:#38bdf8; --bad:#f87171; }
|
||||||
|
body{margin:0;min-height:100vh;display:flex;align-items:center;justify-content:center;
|
||||||
|
font-family:system-ui,Segoe UI,Roboto,sans-serif;background:var(--bg);color:var(--txt);}
|
||||||
|
.card{background:var(--card);border:1px solid #334155;border-radius:14px;padding:28px;width:340px;}
|
||||||
|
h1{font-size:20px;margin:0 0 4px;}
|
||||||
|
.sub{color:var(--muted);font-size:13px;margin-bottom:18px;}
|
||||||
|
label{display:block;font-size:12px;color:var(--muted);margin:10px 0 4px;}
|
||||||
|
input{width:100%;background:#0f172a;color:var(--txt);border:1px solid #334155;border-radius:8px;
|
||||||
|
padding:10px;font-size:14px;}
|
||||||
|
button{width:100%;margin-top:18px;background:var(--accent);color:#04263a;border:none;
|
||||||
|
border-radius:8px;padding:11px;font-size:15px;font-weight:600;cursor:pointer;}
|
||||||
|
.err{background:#7f1d1d;border-radius:8px;padding:10px 12px;font-size:13px;margin-bottom:12px;}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="card">
|
||||||
|
<h1>JB Compta</h1>
|
||||||
|
<div class="sub">Connexion à ton espace comptable.</div>
|
||||||
|
|
||||||
|
{% if form.errors %}
|
||||||
|
<div class="err">Identifiant ou mot de passe incorrect. Vérifie aussi que ton compte est actif.</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<form method="post" action="{% url 'login' %}">
|
||||||
|
{% csrf_token %}
|
||||||
|
<label for="id_username">Identifiant</label>
|
||||||
|
{{ form.username }}
|
||||||
|
<label for="id_password">Mot de passe</label>
|
||||||
|
{{ form.password }}
|
||||||
|
<input type="hidden" name="next" value="{{ next }}">
|
||||||
|
<button type="submit">Se connecter</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
+4
-2
@@ -106,5 +106,7 @@ STORAGES = {
|
|||||||
|
|
||||||
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
|
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
|
||||||
|
|
||||||
# Redirections de connexion vers l'admin
|
# Connexion via la page de l'app (ouverte à tout utilisateur actif, pas seulement staff)
|
||||||
LOGIN_URL = "/admin/login/"
|
LOGIN_URL = "/login/"
|
||||||
|
LOGIN_REDIRECT_URL = "/dashboard/"
|
||||||
|
LOGOUT_REDIRECT_URL = "/login/"
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
|
from django.contrib.auth import views as auth_views
|
||||||
from django.urls import path, include
|
from django.urls import path, include
|
||||||
from django.views.generic import RedirectView
|
from django.views.generic import RedirectView
|
||||||
|
|
||||||
@@ -8,6 +9,8 @@ admin.site.index_title = "Gestion de la micro-entreprise"
|
|||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path("", RedirectView.as_view(url="/dashboard/", permanent=False)),
|
path("", RedirectView.as_view(url="/dashboard/", permanent=False)),
|
||||||
|
path("login/", auth_views.LoginView.as_view(), name="login"),
|
||||||
|
path("logout/", auth_views.LogoutView.as_view(), name="logout"),
|
||||||
path("admin/", admin.site.urls),
|
path("admin/", admin.site.urls),
|
||||||
path("", include("compta.urls")),
|
path("", include("compta.urls")),
|
||||||
]
|
]
|
||||||
|
|||||||
Reference in New Issue
Block a user