Correction API Flask + PostgreSQL + dashboard admin EcoCharge

This commit is contained in:
Safouane Bazzi
2026-03-12 14:50:17 +01:00
parent 6b025aeacb
commit 48acde592b
1033 changed files with 342094 additions and 440 deletions

View File

@@ -3,85 +3,182 @@
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Connexion Admin - EcoCharge</title>
<title>EcoCharge — Connexion</title>
<style>
body {
font-family: Arial, sans-serif;
background: #f4f7fb;
/* ── Variables de couleur ── */
:root {
--vert: #2ecc71;
--bleu: #1a1a2e;
--gris: #16213e;
--blanc: #f0f4f8;
--rouge: #e74c3c;
}
/* ── Reset simple ── */
* {
margin: 0;
padding: 0;
}
.login-container {
width: 360px;
margin: 100px auto;
background: white;
padding: 30px;
border-radius: 12px;
box-shadow: 0 4px 18px rgba(0,0,0,0.12);
}
h2 {
text-align: center;
margin-bottom: 25px;
color: #1f2937;
}
label {
display: block;
margin-bottom: 6px;
margin-top: 15px;
color: #374151;
font-weight: bold;
}
input {
width: 100%;
padding: 10px;
border: 1px solid #d1d5db;
border-radius: 8px;
box-sizing: border-box;
}
button {
/* ── Fond de page ── */
body {
background-color: var(--bleu);
font-family: 'Segoe UI', sans-serif;
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
}
/* ── Carte de connexion ── */
.carte {
background-color: var(--gris);
padding: 48px 40px;
border-radius: 16px;
width: 100%;
margin-top: 20px;
padding: 12px;
max-width: 400px;
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}
/* ── Logo / en-tête ── */
.logo {
text-align: center;
margin-bottom: 32px;
}
.logo-icone {
font-size: 48px;
display: block;
margin-bottom: 8px;
}
.logo h1 {
color: var(--vert);
font-size: 26px;
letter-spacing: 2px;
}
.logo p {
color: #7f8c8d;
font-size: 13px;
margin-top: 4px;
}
/* ── Champs du formulaire ── */
.champ {
margin-bottom: 20px;
}
.champ label {
display: block;
color: var(--blanc);
font-size: 13px;
margin-bottom: 6px;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 1px;
}
.champ input {
width: 100%;
padding: 12px 16px;
border-radius: 8px;
border: 1px solid #2c3e50;
background-color: #0f3460;
color: var(--blanc);
font-size: 15px;
outline: none;
transition: border-color 0.2s;
}
/* Met en valeur le champ actif */
.champ input:focus {
border-color: var(--vert);
}
/* ── Message d'erreur Flask/Jinja ── */
.erreur {
background-color: rgba(231, 76, 60, 0.15);
border: 1px solid var(--rouge);
color: var(--rouge);
padding: 10px 14px;
border-radius: 8px;
font-size: 14px;
margin-bottom: 20px;
text-align: center;
}
/* ── Bouton de connexion ── */
.bouton {
width: 100%;
padding: 13px;
background-color: var(--vert);
color: #fff;
border: none;
border-radius: 8px;
background: #2563eb;
color: white;
font-size: 16px;
font-weight: 700;
cursor: pointer;
letter-spacing: 1px;
transition: background-color 0.2s;
}
button:hover {
background: #1d4ed8;
}
.error {
color: red;
margin-top: 15px;
text-align: center;
.bouton:hover {
background-color: #27ae60;
}
</style>
</head>
<body>
<div class="login-container">
<h2>Connexion Admin</h2>
<div class="carte">
<!-- En-tête avec icône et nom du projet -->
<div class="logo">
<span class="logo-icone"></span>
<h1>ECOCHARGE</h1>
<p>Interface d'administration</p>
</div>
<!-- Message d'erreur affiché si Flask envoie une erreur -->
{% if error %}
<div class="erreur">
{{ error }}
</div>
{% endif %}
<!-- Formulaire de connexion — action vers la route Flask /admin/login -->
<form method="POST" action="/admin/login">
<label for="username">Nom d'utilisateur</label>
<input type="text" id="username" name="username" required>
<label for="password">Mot de passe</label>
<input type="password" id="password" name="password" required>
<div class="champ">
<label for="username">Identifiant</label>
<input
type="text"
id="username"
name="username"
placeholder="admin"
required
autocomplete="username"
>
</div>
<div class="champ">
<label for="password">Mot de passe</label>
<input
type="password"
id="password"
name="password"
placeholder="••••••••"
required
autocomplete="current-password"
>
</div>
<button class="bouton" type="submit">Se connecter</button>
<button type="submit">Se connecter</button>
</form>
{% if error %}
<p class="error">{{ error }}</p>
{% endif %}
</div>
</body>
</html>