P1: Login-Seite gruppiert + Passwort-Anzeigen-Toggle

- Karte und BGG-Logo in einer Spalte gruppiert (vorher Flex-Zeile —
  Logo stand neben der Karte)
- Alpine-Toggle 'Passwort anzeigen/verbergen' (statisch type=password,
  funktioniert ohne JS sicher)
- Fokus-Ringe auf Feldern und Button
This commit is contained in:
Flo Hartmann
2026-08-26 08:50:44 +00:00
parent 9bd3b700c4
commit bba39525a0

View File

@@ -5,40 +5,52 @@
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<title>Anmelden &mdash; {{ app_name }}</title> <title>Anmelden &mdash; {{ app_name }}</title>
<script src="https://cdn.tailwindcss.com"></script> <script src="https://cdn.tailwindcss.com"></script>
<script defer src="https://cdn.jsdelivr.net/npm/alpinejs@3.14.9/dist/cdn.min.js"></script>
<style>[x-cloak] { display: none !important; }</style>
</head> </head>
<body class="bg-slate-100 text-slate-800 min-h-screen flex items-center justify-center px-4"> <body class="bg-slate-100 text-slate-800 min-h-screen flex items-center justify-center px-4 py-8">
<div class="bg-white shadow-md rounded-xl p-8 w-full max-w-sm"> <div class="w-full max-w-sm flex flex-col items-center">
<h1 class="text-xl font-bold mb-1 flex items-center gap-2">{% from "icons.html" import icon_wuerfelbecher %}{{ icon_wuerfelbecher("h-6 w-6 text-emerald-700") }} {{ app_name }}</h1> <div class="bg-white shadow-md rounded-xl p-8 w-full">
<p class="text-sm text-slate-500 mb-6">Bitte anmelden.</p> <h1 class="text-xl font-bold mb-1 flex items-center gap-2">{% from "icons.html" import icon_wuerfelbecher %}{{ icon_wuerfelbecher("h-6 w-6 text-emerald-700") }} {{ app_name }}</h1>
{% if fehler %} <p class="text-sm text-slate-500 mb-6">Bitte anmelden.</p>
<div id="login-fehler" class="mb-4 rounded-lg border border-red-300 bg-red-50 text-red-700 text-sm px-3 py-2" role="alert" tabindex="-1"> {% if fehler %}
{{ fehler }} <div id="login-fehler" class="mb-4 rounded-lg border border-red-300 bg-red-50 text-red-700 text-sm px-3 py-2" role="alert" tabindex="-1">
{{ fehler }}
</div>
{% endif %}
<form method="post" action="/login" class="space-y-4" x-data="{ passwortSichtbar: false }">
<div>
<label for="username" class="block text-sm font-medium mb-1">Benutzername</label>
<input id="username" name="username" value="{{ username }}" required autocomplete="username"
{% if fehler %}aria-invalid="true" aria-describedby="login-fehler"{% endif %}
class="w-full border border-slate-300 rounded-lg px-3 py-2 focus:outline-none focus:ring-2 focus:ring-emerald-500 focus:border-emerald-500">
</div>
<div>
<label for="password" class="block text-sm font-medium mb-1">Passwort</label>
<div class="relative">
<input id="password" name="password" type="password" :type="passwortSichtbar ? 'text' : 'password'" required autocomplete="current-password"
{% if fehler %}aria-invalid="true" aria-describedby="login-fehler"{% endif %}
class="w-full border border-slate-300 rounded-lg px-3 py-2 pr-16 focus:outline-none focus:ring-2 focus:ring-emerald-500 focus:border-emerald-500">
<button type="button" @click="passwortSichtbar = !passwortSichtbar"
:aria-pressed="passwortSichtbar.toString()"
class="absolute inset-y-0 right-0 my-1 mr-1 px-3 rounded-lg text-xs font-medium text-slate-500 hover:bg-slate-100 hover:text-slate-700">
<span x-show="!passwortSichtbar">Anzeigen</span>
<span x-show="passwortSichtbar" x-cloak>Verbergen</span>
</button>
</div>
</div>
<button type="submit"
class="w-full min-h-[44px] bg-emerald-600 hover:bg-emerald-700 active:bg-emerald-800 text-white font-medium rounded-lg px-3 py-2 focus:outline-none focus:ring-2 focus:ring-emerald-500 focus:ring-offset-2">
Anmelden
</button>
</form>
</div>
<div class="mt-6 text-center">
<a href="https://boardgamegeek.com" target="_blank" rel="noopener noreferrer">
<img src="/static/powered-by-bgg.png" alt="Powered by BoardGameGeek"
width="120" height="35" class="inline-block opacity-80 hover:opacity-100">
</a>
</div> </div>
{% endif %}
<form method="post" action="/login" class="space-y-4">
<div>
<label for="username" class="block text-sm font-medium mb-1">Benutzername</label>
<input id="username" name="username" value="{{ username }}" required autocomplete="username"
{% if fehler %}aria-invalid="true" aria-describedby="login-fehler"{% endif %}
class="w-full border border-slate-300 rounded-lg px-3 py-2 focus:outline-none focus:ring-2 focus:ring-emerald-500">
</div>
<div>
<label for="password" class="block text-sm font-medium mb-1">Passwort</label>
<input id="password" name="password" type="password" required autocomplete="current-password"
{% if fehler %}aria-invalid="true" aria-describedby="login-fehler"{% endif %}
class="w-full border border-slate-300 rounded-lg px-3 py-2 focus:outline-none focus:ring-2 focus:ring-emerald-500">
</div>
<button type="submit"
class="w-full min-h-[44px] bg-emerald-600 hover:bg-emerald-700 active:bg-emerald-800 text-white font-medium rounded-lg px-3 py-2">
Anmelden
</button>
</form>
</div>
<div class="mt-6 text-center">
<a href="https://boardgamegeek.com" target="_blank" rel="noopener noreferrer">
<img src="/static/powered-by-bgg.png" alt="Powered by BoardGameGeek"
width="120" height="35" class="inline-block opacity-80 hover:opacity-100">
</a>
</div> </div>
</body> </body>
</html> </html>