gestion supp user admin

This commit is contained in:
2026-05-11 22:55:30 +02:00
parent 2cab2ddd1d
commit 01cf4dd5a1
17 changed files with 728 additions and 8 deletions

View File

@@ -0,0 +1,67 @@
import React from 'react';
import { prisma } from '@/lib/prisma';
import ReactivateForm from './ReactivateForm';
import { ShieldCheck, AlertTriangle } from 'lucide-react';
import Link from 'next/link';
export default async function ReactivatePage({ searchParams: searchParamsPromise }: { searchParams: Promise<{ id?: string }> }) {
const searchParams = await searchParamsPromise;
const userId = searchParams.id;
if (!userId) {
return (
<div className="min-h-screen flex items-center justify-center p-6 bg-slate-50">
<div className="max-w-md w-full bg-white rounded-3xl shadow-xl p-8 text-center">
<AlertTriangle className="w-16 h-16 text-amber-500 mx-auto mb-4" />
<h1 className="text-2xl font-bold text-slate-900 mb-2">Lien invalide</h1>
<p className="text-slate-600 mb-6">Ce lien de réactivation est incomplet ou expiré.</p>
<Link href="/" className="inline-block px-8 py-3 bg-indigo-600 text-white rounded-xl font-bold shadow-lg shadow-indigo-200 hover:bg-indigo-700 transition-all">
Retour à l'accueil
</Link>
</div>
</div>
);
}
const user = await prisma.user.findUnique({
where: { id: userId },
select: { id: true, name: true, deletedAt: true }
});
if (!user || !user.deletedAt) {
return (
<div className="min-h-screen flex items-center justify-center p-6 bg-slate-50">
<div className="max-w-md w-full bg-white rounded-3xl shadow-xl p-8 text-center">
<ShieldCheck className="w-16 h-16 text-emerald-500 mx-auto mb-4" />
<h1 className="text-2xl font-bold text-slate-900 mb-2">Compte déjà actif</h1>
<p className="text-slate-600 mb-6">Votre compte est déjà actif ou n'a jamais é marqué pour suppression.</p>
<Link href="/login" className="inline-block px-8 py-3 bg-indigo-600 text-white rounded-xl font-bold shadow-lg shadow-indigo-200 hover:bg-indigo-700 transition-all">
Se connecter
</Link>
</div>
</div>
);
}
return (
<div className="min-h-screen flex items-center justify-center p-6 bg-slate-50">
<div className="max-w-xl w-full bg-white rounded-3xl shadow-xl p-10">
<div className="text-center mb-8">
<div className="w-20 h-20 bg-indigo-100 rounded-2xl flex items-center justify-center text-indigo-600 mx-auto mb-4">
<ShieldCheck className="w-10 h-10" />
</div>
<h1 className="text-3xl font-bold text-slate-900">Réactiver mon compte</h1>
<p className="text-slate-500 mt-2">Heureux de vous revoir, {user.name} !</p>
</div>
<div className="bg-amber-50 border border-amber-200 rounded-2xl p-5 mb-8">
<p className="text-sm text-amber-800 leading-relaxed">
Votre compte était programmé pour une suppression définitive. En le réactivant, vous conservez toutes vos données, vos messages et vos favoris.
</p>
</div>
<ReactivateForm userId={userId} />
</div>
</div>
);
}