smtp: typed probe errors with per-field UI highlighting on save

This commit is contained in:
Pontoporeia
2026-04-30 12:16:52 +02:00
parent b750aca2f5
commit bdb68479d5
7 changed files with 341 additions and 198 deletions

17
TODO.md
View File

@@ -65,9 +65,20 @@
## SMTP credential validation
- [x] Add `SmtpRelay::test()` — connect + EHLO + STARTTLS + AUTH + QUIT, no message sent
- [x] Add `SmtpRelay::smtpProbe()` — private low-level probe (mirrors smtpSend without envelope/data)
- [x] Wire into `actions/settings.php` SMTP branch: probe immediately after save, flash success or error with detail
- [x] Add `SmtpProbeException` with `field` property for structured error classification
- [x] Add `SmtpRelay::test()` — returns `{ok, error, field}` with field = input id to highlight
- [x] `smtpProbe()` throws typed exceptions per failure point:
- connect fail → name resolution error → `smtp_host`
- connect fail → port refused → `smtp_port`
- connect fail → timeout → `smtp_host`
- bad greeting / timeout after connect → `smtp_host` / `smtp_port`
- STARTTLS not supported / TLS negotiation fail → `smtp_encryption`
- AUTH rejected, code 535 → `smtp_password`; other auth failures → `smtp_username`
- [x] `actions/settings.php`: store `$_SESSION['_flash_smtp_field']` on probe failure
- [x] `parametres.php` controller: consume + clear `_flash_smtp_field` into `$smtpErrorField`
- [x] Template: `aria-invalid`, `aria-describedby`, inline `<small class="param-field-error">` per field
- [x] JS: scroll + focus the offending field on page load
- [x] CSS: red `border-bottom` on `[aria-invalid]`, `.param-field-error` error text style
## Répertoire layout