Modification des pages d'authentification

This commit is contained in:
2026-06-14 21:58:05 +02:00
parent dc28b12c27
commit 9f6363ec20
20 changed files with 2494 additions and 172 deletions
+2 -2
View File
@@ -77,7 +77,7 @@ const DEFAULT_STATE = {
username: '',
password: '',
allowUnauth: false,
appName: 'Crowdlending',
appName: 'Crowdlending Tracker',
appUrl: '',
};
@@ -109,7 +109,7 @@ export default function SmtpSection() {
username: data.username || '',
password: '',
allowUnauth: !!data.allowUnauth,
appName: data.appName || 'Crowdlending',
appName: data.appName || 'Crowdlending Tracker',
appUrl: data.appUrl || '',
});
setHasPassword(!!data.hasPassword);
+28 -1
View File
@@ -36,6 +36,21 @@ export default function UsersSection({ currentUserId }) {
});
};
const verifyEmail = (u) => {
setConfirmAction({
title: 'Vérifier l\'email manuellement',
message: `Marquer l'email de ${u.display_name || u.email} comme vérifié ?`,
confirmLabel: 'Confirmer',
onConfirm: async () => {
try {
await api.patch(`/admin/users/${u.id}/verify-email`, {});
load();
} catch (e) { setErr('Erreur : ' + e.message); }
finally { setConfirmAction(null); }
},
});
};
const deleteUser = (u) => {
setConfirmAction({
title: 'Supprimer l\'utilisateur',
@@ -66,6 +81,7 @@ export default function UsersSection({ currentUserId }) {
<th style={{ width: 36 }}>ID</th>
<th>Nom</th>
<th>Email</th>
<th>Email vérifié</th>
<th>Rôle</th>
<th>Créé le</th>
<th>Actions</th>
@@ -77,10 +93,16 @@ export default function UsersSection({ currentUserId }) {
<td style={{ color: 'var(--text-muted)' }}>{u.id}</td>
<td style={{ fontWeight: 500 }}>{u.display_name || <em style={{ color: 'var(--text-muted)' }}></em>}</td>
<td>{u.email}</td>
<td>
{u.email_verified
? <span style={{ fontSize: 11, fontWeight: 600, padding: '2px 8px', borderRadius: 10, background: 'var(--success-bg, #f0fdf4)', color: 'var(--success, #16a34a)', border: '1px solid #bbf7d0' }}> Vérifié</span>
: <span style={{ fontSize: 11, fontWeight: 600, padding: '2px 8px', borderRadius: 10, background: 'var(--warning-bg, #fffbeb)', color: 'var(--warning-text, #92400e)', border: '1px solid #fcd34d' }}>En attente</span>
}
</td>
<td><Badge role={u.role} /></td>
<td style={{ color: 'var(--text-muted)', fontSize: 12 }}>{fmt(u.created_at)}</td>
<td>
<div style={{ display: 'flex', gap: 8 }}>
<div style={{ display: 'flex', gap: 8, flexWrap: 'wrap' }}>
<button
className="btn btn-sm btn-outline"
onClick={() => toggleRole(u)}
@@ -89,6 +111,11 @@ export default function UsersSection({ currentUserId }) {
>
{u.role === 'admin' ? '→ Utilisateur' : '→ Admin'}
</button>
{!u.email_verified && (
<button className="btn btn-sm btn-outline" onClick={() => verifyEmail(u)}>
Vérifier email
</button>
)}
{u.id !== currentUserId && (
<button className="btn btn-sm btn-danger" onClick={() => deleteUser(u)}>
Supprimer