29 lines
1.3 KiB
Twig
29 lines
1.3 KiB
Twig
<header style="border-bottom: 1px solid #ccc; padding: 1rem 0; margin-bottom: 2rem;">
|
|
<div style="display: flex; justify-content: space-between; align-items: center;">
|
|
<h1 style="margin: 0;">
|
|
<a href="/" style="text-decoration: none; color: inherit;">Mon Blog</a>
|
|
</h1>
|
|
|
|
<nav>
|
|
{% if session.user_id is defined and session.user_id %}
|
|
{# Utilisateur connecté #}
|
|
<span style="margin-right: 1rem;">
|
|
Connecté en tant que : <strong>{{ session.username }}</strong>
|
|
</span>
|
|
<a href="/admin" style="margin-right: 1rem;">Admin</a>
|
|
<form method="post" action="/logout" style="display: inline;">
|
|
<input type="hidden" name="{{ csrf.keys.name }}" value="{{ csrf.name }}">
|
|
<input type="hidden" name="{{ csrf.keys.value }}" value="{{ csrf.value }}">
|
|
<button type="submit"
|
|
style="background: none; border: none; color: #007bff; cursor: pointer; text-decoration: underline;">
|
|
Déconnexion
|
|
</button>
|
|
</form>
|
|
{% else %}
|
|
{# Utilisateur non connecté #}
|
|
<a href="/login" style="margin-right: 1rem;">Connexion</a>
|
|
<a href="/register">S'enregistrer</a>
|
|
{% endif %}
|
|
</nav>
|
|
</div>
|
|
</header> |