feat: Connexion utilisateur avec sécurité renforcée
Implémente la Story 1.4 du système d'authentification avec plusieurs couches de protection contre les attaques par force brute. Sécurité backend : - Authentification JWT avec access token (15min) + refresh token (7j) - Rotation automatique des refresh tokens avec détection de replay - Rate limiting progressif par IP (délai Fibonacci après échecs) - Intégration Cloudflare Turnstile CAPTCHA après 5 tentatives - Alerte email à l'utilisateur après blocage temporaire - Isolation multi-tenant (un utilisateur ne peut se connecter que sur son établissement) Frontend : - Page de connexion avec feedback visuel des délais et erreurs - Composant TurnstileCaptcha réutilisable - Gestion d'état auth avec stockage sécurisé des tokens - Tests E2E Playwright pour login, tenant isolation, et activation Infrastructure : - Configuration Symfony Security avec json_login + jwt - Cache pools séparés (filesystem en test, Redis en prod) - NullLoginRateLimiter pour environnement de test (évite blocage CI) - Génération des clés JWT en CI après démarrage du backend
This commit is contained in:
150
backend/templates/email/lockout_alert.html.twig
Normal file
150
backend/templates/email/lockout_alert.html.twig
Normal file
@@ -0,0 +1,150 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Alerte de sécurité - Classeo</title>
|
||||
<style>
|
||||
body {
|
||||
font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
|
||||
line-height: 1.6;
|
||||
color: #1e293b;
|
||||
background-color: #f8fafc;
|
||||
margin: 0;
|
||||
padding: 20px;
|
||||
}
|
||||
.container {
|
||||
max-width: 560px;
|
||||
margin: 0 auto;
|
||||
background: #ffffff;
|
||||
border-radius: 12px;
|
||||
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
|
||||
overflow: hidden;
|
||||
}
|
||||
.header {
|
||||
background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
|
||||
padding: 24px 32px;
|
||||
text-align: center;
|
||||
}
|
||||
.header h1 {
|
||||
color: #ffffff;
|
||||
font-size: 20px;
|
||||
font-weight: 600;
|
||||
margin: 0;
|
||||
}
|
||||
.content {
|
||||
padding: 32px;
|
||||
}
|
||||
.alert-icon {
|
||||
text-align: center;
|
||||
margin-bottom: 24px;
|
||||
}
|
||||
.alert-icon span {
|
||||
display: inline-block;
|
||||
width: 48px;
|
||||
height: 48px;
|
||||
background: #fef2f2;
|
||||
border-radius: 50%;
|
||||
line-height: 48px;
|
||||
font-size: 24px;
|
||||
}
|
||||
.message {
|
||||
margin-bottom: 24px;
|
||||
}
|
||||
.info-box {
|
||||
background: #f8fafc;
|
||||
border: 1px solid #e2e8f0;
|
||||
border-radius: 8px;
|
||||
padding: 16px;
|
||||
margin: 24px 0;
|
||||
}
|
||||
.info-box table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
.info-box td {
|
||||
padding: 6px 0;
|
||||
font-size: 14px;
|
||||
}
|
||||
.info-box td:first-child {
|
||||
color: #64748b;
|
||||
width: 120px;
|
||||
}
|
||||
.warning {
|
||||
background: #fffbeb;
|
||||
border-left: 4px solid #f59e0b;
|
||||
padding: 12px 16px;
|
||||
margin: 24px 0;
|
||||
font-size: 14px;
|
||||
color: #92400e;
|
||||
}
|
||||
.footer {
|
||||
background: #f8fafc;
|
||||
padding: 20px 32px;
|
||||
text-align: center;
|
||||
font-size: 13px;
|
||||
color: #64748b;
|
||||
border-top: 1px solid #e2e8f0;
|
||||
}
|
||||
.logo {
|
||||
font-weight: 700;
|
||||
color: #0ea5e9;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<div class="header">
|
||||
<h1>🔒 Alerte de sécurité</h1>
|
||||
</div>
|
||||
<div class="content">
|
||||
<div class="alert-icon">
|
||||
<span>⚠️</span>
|
||||
</div>
|
||||
|
||||
<div class="message">
|
||||
<p>Bonjour,</p>
|
||||
<p>
|
||||
Nous avons détecté <strong>{{ failedAttempts }} tentatives de connexion échouées</strong>
|
||||
sur votre compte Classeo. Par mesure de sécurité, votre compte a été
|
||||
<strong>temporairement bloqué</strong>.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div class="info-box">
|
||||
<table>
|
||||
<tr>
|
||||
<td>Date :</td>
|
||||
<td>{{ occurredOn|date('d/m/Y à H:i') }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Adresse IP :</td>
|
||||
<td>{{ ipAddress }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Durée du blocage :</td>
|
||||
<td>{{ blockedForMinutes }} minutes</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="warning">
|
||||
<strong>Si vous n'êtes pas à l'origine de ces tentatives</strong>, nous vous recommandons de
|
||||
changer votre mot de passe dès que possible après le déblocage de votre compte.
|
||||
</div>
|
||||
|
||||
<p>
|
||||
Vous pourrez vous reconnecter dans <strong>{{ blockedForMinutes }} minutes</strong>.
|
||||
</p>
|
||||
|
||||
<p style="color: #64748b; font-size: 14px;">
|
||||
Si vous avez des questions, contactez l'administration de votre établissement.
|
||||
</p>
|
||||
</div>
|
||||
<div class="footer">
|
||||
<p><span class="logo">📚 Classeo</span> — L'application qui rend serein</p>
|
||||
<p>Cet email a été envoyé automatiquement suite à une alerte de sécurité.</p>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user