Ajoute un administrateur qui gère les comptes

Le premier compte inscrit devient administrateur. La page /admin lui
permet de lister, créer, modifier et supprimer les comptes, même quand
les inscriptions sont fermées.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Romulus21andClaude Opus 5.5 committed 2026-10-11 14:03:47 +02:00
1 parent 2ade50465e
commit f3f5f0cee1
7 files changed
+539 -34

No files matched your search

+15 -3
View File
@@ -97,7 +97,7 @@ fn AuthLayout(title: &'static str, children: Children) -> impl IntoView {
}
#[component]
fn FormError(#[prop(into)] error: Signal<Option<String>>) -> impl IntoView {
pub fn FormError(#[prop(into)] error: Signal<Option<String>>) -> impl IntoView {
move || {
error.get().map(|msg| {
view! {
@@ -207,7 +207,7 @@ pub fn RegisterPage() -> impl IntoView {
}
#[component]
fn Field(label: &'static str, children: Children) -> impl IntoView {
pub fn Field(label: &'static str, children: Children) -> impl IntoView {
view! {
<label class="flex flex-col gap-1.5">
<span class="font-mono text-xs tracking-[0.2em] text-ink/60 uppercase">{label}</span>
@@ -241,7 +241,19 @@ pub fn AccountSheet(user: User) -> impl IntoView {
<Show when=move || ctx.account_open.get()>
<Sheet title=user.with_value(|u| u.name.clone()) on_close=close>
<p class="mt-1 text-ink/70">{user.with_value(|u| u.email.clone())}</p>
<ActionForm action=auth.logout attr:class="mt-6">
{user
.with_value(|u| u.is_admin)
.then(|| {
view! {
<A
href="/admin"
attr:class="mt-6 block w-full rounded-2xl border-2 border-ink bg-lime px-4 py-3 text-center font-semibold"
>
"Gérer les utilisateurs"
</A>
}
})}
<ActionForm action=auth.logout attr:class="mt-3">
<button
type="submit"
class="w-full rounded-2xl border-2 border-ink px-4 py-3 font-semibold"