gestion de la connexion de l'utilisateur
This commit is contained in:
@@ -2,16 +2,30 @@
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>{% block title %}Welcome!{% endblock %}</title>
|
||||
<title>{% block title %}Association KAZ{% endblock %}</title>
|
||||
<link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 128 128%22><text y=%221.2em%22 font-size=%2296%22>⚫️</text><text y=%221.3em%22 x=%220.2em%22 font-size=%2276%22 fill=%22%23fff%22>sf</text></svg>">
|
||||
{% block stylesheets %}
|
||||
<link rel="stylesheet" href="/assets/styles/app.css">
|
||||
<link rel="stylesheet" href="{{ asset('styles/app.css') }}">
|
||||
{% endblock %}
|
||||
|
||||
{% block javascripts %}
|
||||
{% block importmap %}{{ importmap('app') }}{% endblock %}
|
||||
{% endblock %}
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<main class="container mx-auto mt-4 px-4">
|
||||
{# Section des notifications #}
|
||||
{% for label, messages in app.flashes %}
|
||||
{% for message in messages %}
|
||||
<div class="p-4 mb-4 rounded-lg shadow-md border-l-4 {{ label == 'success' ? 'bg-brand-teal text-brand-dark border-bg-secondary' : 'bg-brand-gold text-brand-dark border-red-700' }}">
|
||||
{{ message }}
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
|
||||
{% block body %}{% endblock %}
|
||||
</main>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block title %}Accueil | Tableau de bord KAZ{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<div class="mt-8 p-6 bg-white rounded-lg shadow-md border border-gray-200">
|
||||
<h1 class="text-3xl font-bold mb-4">Bienvenue sur ton tableau de bord KAZ </h1>
|
||||
|
||||
{# Vérification si un utilisateur est connecté #}
|
||||
{% if app.user %}
|
||||
<div class="p-4 bg-green-100 text-green-800 rounded mb-4">
|
||||
<p class="font-semibold">Succès ! Tu es connecté avec l'adresse :</p>
|
||||
<p class="text-xl">{{ app.user.userIdentifier }}</p>
|
||||
</div>
|
||||
|
||||
<p class="mt-4">
|
||||
<a href="{{ path('app_logout') }}" class="inline-block px-4 py-2 bg-red-600 text-white rounded hover:bg-red-700">
|
||||
Se déconnecter
|
||||
</a>
|
||||
</p>
|
||||
{% else %}
|
||||
<p class="mb-4">Tu n'es pas encore connecté à ton espace.</p>
|
||||
<a href="{{ path('app_login') }}" class="inline-block px-4 py-2 bg-blue-600 text-white rounded hover:bg-blue-700">
|
||||
Aller à la page de connexion
|
||||
</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
@@ -1,39 +1,34 @@
|
||||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block title %}Log in!{% endblock %}
|
||||
{% block title %}Se connecter | {{ parent() }}{% endblock %}
|
||||
|
||||
{% block body %}
|
||||
<form method="post">
|
||||
{% if error %}
|
||||
<div class="p-4 mb-4 text-sm text-red-800 rounded-lg bg-red-50 border border-red-200">
|
||||
Email ou mot de passe invalide.
|
||||
</div>
|
||||
{% endif %}
|
||||
<form method="post">
|
||||
{% if error %}
|
||||
<div class="alert alert-danger">{{ error.messageKey|trans(error.messageData, 'security') }}</div>
|
||||
{% endif %}
|
||||
|
||||
{% if app.user %}
|
||||
<div class="mb-3">
|
||||
You are logged in as {{ app.user.userIdentifier }}, <a href="{{ logout_path() }}">Se déconnecter</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if app.user %}
|
||||
<div class="mb-3">
|
||||
You are logged in as {{ app.user.userIdentifier }}, <a href="{{ logout_path() }}">Logout</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<h1 class="h3 mb-3 font-weight-normal">Se connecter à mon compte KAZ</h1>
|
||||
<label for="username">Email</label>
|
||||
<input type="email" value="{{ last_username }}" name="_username" id="username" class="form-control" autocomplete="email" required autofocus>
|
||||
<label for="password">Mot de passe</label>
|
||||
<input type="password" name="_password" id="password" class="form-control" autocomplete="current-password" required>
|
||||
<input type="hidden" name="_csrf_token" data-controller="csrf-protection" value="{{ csrf_token('authenticate') }}">
|
||||
<h1 class="h3 mb-3 font-weight-normal">Se connecter à mon tableau de bord KAZ</h1>
|
||||
<label for="inputEmail">Email :</label>
|
||||
<input type="email" value="{{ last_username }}" name="_username" id="inputEmail" class="form-control" autocomplete="email" required autofocus>
|
||||
<label for="inputPassword">Mot de passe : </label>
|
||||
<input type="password" name="_password" id="inputPassword" class="form-control" autocomplete="current-password" required>
|
||||
<input type="hidden" name="_csrf_token" data-controller="csrf-protection" value="{{ csrf_token('authenticate') }}">
|
||||
|
||||
<div class="checkbox mb-3">
|
||||
<label>
|
||||
<input type="checkbox" name="_remember_me"> Se souvenir de moi
|
||||
</label>
|
||||
</div>
|
||||
|
||||
{# TODO : vérifier qu'il y a bien une option "Se souvenir de moi" dans mon firewall pour activer la fonctionnalité. #}
|
||||
{# pour en savoir plus : https://symfony.com/doc/current/security/remember_me.html #}
|
||||
|
||||
<div class="checkbox mb-3">
|
||||
<input type="checkbox" name="_remember_me" id="_remember_me">
|
||||
<label for="_remember_me">Se souvenir de moi</label>
|
||||
</div>
|
||||
|
||||
<button class="btn btn-lg btn-primary" type="submit">
|
||||
Se connecter
|
||||
</button>
|
||||
</form>
|
||||
<button class="btn btn-lg btn-primary" type="submit">
|
||||
Se connecter
|
||||
</button>
|
||||
</form>
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user