Add custom auth, connection testing, preconfig_only, and security fixes

Major form improvements:
- Custom SMTP/Sieve credentials (separate username/password per protocol)
- Connection testing on save (IMAP, SMTP, Sieve) with localized errors
- preconfig_only mode to restrict domains to preconfigured entries
- Form POST value preservation on save errors (auth selects, passwords)
- Smart host placeholders (SMTP/Sieve default to IMAP host)

Security and bug:
- Fix password re-encryption bug (was comparing raw vs encrypted values)
- Fix XSS: escape label output in special folders form
- Fix parse_url() return value not checked for false
- Fix decrypt() failures not handled (fallback to empty string)
- Sanitize log output (remove raw POST data from log messages)
- Replace weak == comparisons with strict === (PHP and JS)

SQL changes:
- Consolidate 4 migrations (2026021000-03) into single 2026021000
- Remove now unused notify_sound_url column
- Add smtp_username, smtp_password, sieve_username, sieve_password columns
This commit is contained in:
Laurent Dinclaux
2026-02-10 20:48:49 +11:00
parent 3a8202bd7a
commit fd9836c7ae
25 changed files with 1042 additions and 209 deletions

View File

@@ -4,14 +4,20 @@
*/
$labels = array();
// Plugin ident_switch
$labels['form.common.caption'] = 'Plugin ident_switch';
// Separate Account
$labels['form.caption'] = 'Account separato';
$labels['form.description'] = 'Configura questa identità come un account separato con le proprie connessioni al server di posta.';
$labels['form.preconfig_only_warning'] = 'La configurazione come account separato non è disponibile per il dominio %s.';
// General
$labels['form.common.general'] = 'Generale';
// Enabled
$labels['form.common.enabled'] = 'Abilita';
// Label
$labels['form.common.label'] = 'Nome visualizzato';
$labels['form.common.label.hint'] = 'Nome visualizzato nel selettore account. Se vuoto, viene utilizzato l\'indirizzo email.';
// Value in \'Label\' field is too long (32 chars max).
$labels['err.label.long'] = 'Il valore del campo \'Nome Visualizzato\' è troppo lungo (massimo 32 caratteri).';
@@ -20,8 +26,8 @@ $labels['err.label.long'] = 'Il valore del campo \'Nome Visualizzato\' è troppo
// IMAP
$labels['form.imap.caption'] = 'IMAP';
// Server host name
$labels['form.imap.host'] = 'Nome del server';
// Incoming mail server
$labels['form.imap.host'] = 'Server posta in arrivo';
// Security
$labels['form.imap.security'] = 'Sicurezza';
@@ -47,8 +53,8 @@ $labels['err.user.long'] = 'Il valore del campo \'Username\' è troppo lungo (ma
// SMTP
$labels['form.smtp.caption'] = 'SMTP';
// Server host name
$labels['form.smtp.host'] = 'Nome del server';
// Outgoing mail server
$labels['form.smtp.host'] = 'Server posta in uscita';
// Security
$labels['form.smtp.security'] = 'Sicurezza';
@@ -65,6 +71,15 @@ $labels['form.smtp.auth.imap'] = 'Come IMAP';
// None
$labels['form.smtp.auth.none'] = 'Nessuna';
// Custom
$labels['form.smtp.auth.custom'] = 'Personalizzata';
// Username
$labels['form.smtp.username'] = 'Username';
// Password
$labels['form.smtp.password'] = 'Password';
// Sieve
$labels['form.sieve.caption'] = 'Sieve';
@@ -87,6 +102,15 @@ $labels['form.sieve.auth.imap'] = 'Come IMAP';
// None
$labels['form.sieve.auth.none'] = 'Nessuna';
// Custom
$labels['form.sieve.auth.custom'] = 'Personalizzata';
// Username
$labels['form.sieve.username'] = 'Username';
// Password
$labels['form.sieve.password'] = 'Password';
// Notifications
$labels['form.notify.caption'] = 'Notifiche';
@@ -140,3 +164,12 @@ $labels['err.port.num'] = 'Il valore del campo \'Porta\' deve essere un numero.'
// Value in \'Port\' field must be between 1 and 65535.
$labels['err.port.range'] = 'Il valore del campo \'Porta\' deve essere compreso tra 1 e 65535.';
// IMAP connection test failed.
$labels['err.imap.connect'] = 'Connessione IMAP fallita. Verificare l\'indirizzo del server, la porta e le credenziali.';
// SMTP connection test failed.
$labels['err.smtp.connect'] = 'Connessione SMTP fallita. Verificare l\'indirizzo del server, la porta e le credenziali.';
// Sieve connection test failed.
$labels['err.sieve.connect'] = 'Connessione Sieve fallita. Verificare l\'indirizzo del server, la porta e le credenziali.';