Commit Graph

11 Commits

Author SHA1 Message Date
Laurent Dinclaux
e4bd92ca63 Replace enabled checkbox with account mode select
Identities can now be set as primary (default), alias of an existing
separate account, or separate account. Alias records store parent_id
and skip server validation. Password sentinel changed to a safe string
that survives HTML form round-trips. Preconfig host composition fixed
to include security scheme.
2026-02-10 22:28:30 +11:00
Laurent Dinclaux
fd9836c7ae 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
2026-02-10 20:50:05 +11:00
Laurent Dinclaux
3a8202bd7a Align Checker port resolution and add delimiter preconfig support 2026-02-10 18:38:42 +11:00
Laurent Dinclaux
39fe417104 Add Auto/Manual mode select for IMAP delimiter 2026-02-10 18:15:43 +11:00
Laurent Dinclaux
36b9b3e35f Replace TLS checkbox with security dropdown (None/STARTTLS/SSL)
Replace the single IMAP TLS checkbox with a per-protocol security
dropdown for IMAP, SMTP, and Sieve. The security scheme (ssl:// or
tls://) is now stored directly in the host field, unifying the approach
across all protocols.

Smart form behavior:
- Default ports update automatically when changing security type
- Fields clear on blur when value matches the placeholder
- Warning shown when selecting no encryption
- Defaults: IMAP SSL/993, SMTP STARTTLS/587, Sieve STARTTLS/4190

The DB_SECURE_IMAP_TLS flag is no longer written but still read for
backward compatibility with existing records.
2026-02-10 17:54:36 +11:00
Laurent Dinclaux
780cfc6a7e Add wildcard domain support in preconfig
Use '*' as a catch-all domain key in ident_switch.preconfig to provide
default settings for any domain not explicitly listed.
2026-02-10 17:46:58 +11:00
Laurent Dinclaux
fc13088c62 Use auto-detect for IMAP folder hierarchy delimiter
Roundcube auto-detects the delimiter from the IMAP server via LIST
command. Remove hardcoded fallback values and let Roundcube handle
detection when no delimiter is explicitly configured.
2026-02-10 17:46:15 +11:00
Laurent Dinclaux
12572b563d Add background mail checking and new mail notifications 2026-02-10 17:13:57 +11:00
Laurent Dinclaux
6ea4aee0a7 Add managesieve (Sieve) support for remote accounts
When switching identities, the managesieve plugin still connected to
the default sieve server. Hook into managesieve_connect to redirect
the sieve connection to the remote account's server.

Adds sieve_host, sieve_port and sieve_auth columns to the database,
a Sieve section to the identity settings form, preconfig support for
sieve_host, and localized labels for all 7 languages.
2026-02-10 14:03:47 +11:00
Laurent Dinclaux
9ebe30c40a Support separate IMAP and SMTP hosts in preconfig
The preconfig previously used a single 'host' field for both IMAP and
SMTP, making it impossible to configure different servers/schemes/ports
(e.g. IMAPS on 993 + SMTP STARTTLS on 587). Also, ssl:// scheme was
silently lost during parse_url() since only tls:// was recognized.

Add imap_host and smtp_host as separate config keys with full scheme
support (ssl://, tls://). The legacy 'host' key is still supported as
fallback for backward compatibility.
2026-02-10 14:02:52 +11:00
Laurent Dinclaux
651bb19d05 Split ident_switch.php into focused classes
Extract business logic into dedicated classes under lib/:
- IdentSwitchForm: form building, validation, and persistence
- IdentSwitchSwitcher: account switching, SMTP config, special folders
- IdentSwitchPreconfig: domain-based preconfiguration

The main plugin class remains the orchestrator, registering hooks
and delegating to the appropriate handler. Constants changed from
private to public to allow cross-class access.
2026-02-10 14:02:49 +11:00