mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-05-06 19:19:19 +02:00
smtp: typed probe errors with per-field UI highlighting on save
This commit is contained in:
@@ -51,9 +51,12 @@ if ($section === 'formulaire') {
|
||||
// Immediately probe the server to validate credentials
|
||||
$test = SmtpRelay::test($db);
|
||||
if ($test['ok']) {
|
||||
App::flash('success', "Paramètres SMTP mis à jour — connexion validée avec succès ✓");
|
||||
App::flash('success', "Paramètres SMTP mis à jour — connexion validée ✓");
|
||||
} else {
|
||||
App::flash('error', "Paramètres sauvegardés, mais le test de connexion SMTP a échoué : " . $test['error']);
|
||||
App::flash('error', "Paramètres sauvegardés, mais le test de connexion a échoué : " . $test['error']);
|
||||
if ($test['field'] !== null) {
|
||||
$_SESSION['_flash_smtp_field'] = $test['field'];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
App::flash('error', "Section inconnue.");
|
||||
|
||||
@@ -13,8 +13,10 @@ require_once APP_ROOT . '/src/SmtpRelay.php';
|
||||
$db = new Database();
|
||||
$siteSettings = $db->getAllSettings();
|
||||
$stats = $db->getThesesStats();
|
||||
$smtpSettings = SmtpRelay::getSettings($db);
|
||||
$smtpConfigured = SmtpRelay::isConfigured($db);
|
||||
$smtpSettings = SmtpRelay::getSettings($db);
|
||||
$smtpConfigured = SmtpRelay::isConfigured($db);
|
||||
$smtpErrorField = $_SESSION['_flash_smtp_field'] ?? null;
|
||||
unset($_SESSION['_flash_smtp_field']);
|
||||
|
||||
// ── System section ────────────────────────────────────────────────────────────
|
||||
require_once APP_ROOT . '/src/SystemCache.php';
|
||||
|
||||
@@ -1275,6 +1275,20 @@
|
||||
padding: 0 var(--space-xs);
|
||||
}
|
||||
|
||||
/* SMTP field validation error state */
|
||||
.param-grid input[aria-invalid="true"],
|
||||
.param-grid select[aria-invalid="true"] {
|
||||
border-bottom-color: var(--search-error-border, #c0392b);
|
||||
}
|
||||
|
||||
.param-field-error {
|
||||
display: block;
|
||||
font-size: var(--step--2);
|
||||
color: var(--search-error-border, #c0392b);
|
||||
margin-top: var(--space-3xs);
|
||||
line-height: 1.3;
|
||||
}
|
||||
|
||||
/* ── Settings page sections — legacy aliases (kept for any remaining use) ─ */
|
||||
.admin-settings-section {
|
||||
border: 1px solid var(--border-primary);
|
||||
|
||||
Reference in New Issue
Block a user