fix(email): IMAP Security dropdown auto-fills the conventional port
Selecting SSL/TLS sets port 993 and STARTTLS/none sets 143, so the port in the dropdown label is no longer just decoration. A non-standard custom port (anything other than 993/143/empty) is left untouched.
This commit is contained in:
@@ -30,6 +30,20 @@ export const IncomingMailConfigCard: React.FC = () => {
|
||||
|
||||
const set = (k: keyof IncomingMailConfig, v: any) => setCfg((c) => ({ ...c, [k]: v }));
|
||||
|
||||
// Changing Security auto-fills the conventional IMAP port (SSL/TLS → 993,
|
||||
// STARTTLS/none → 143) so the port in the dropdown label isn't just
|
||||
// decoration. A non-standard custom port is left untouched.
|
||||
const onSecurityChange = (val: string) => {
|
||||
const secure = val === 'ssl';
|
||||
setCfg((c) => {
|
||||
const next = { ...c, imap_secure: secure };
|
||||
if (!c.imap_port || c.imap_port === 993 || c.imap_port === 143) {
|
||||
next.imap_port = secure ? 993 : 143;
|
||||
}
|
||||
return next;
|
||||
});
|
||||
};
|
||||
|
||||
const save = useMutation({
|
||||
mutationFn: () => {
|
||||
// Mirror the SMTP card's client-side required guard. Host + port +
|
||||
@@ -91,7 +105,7 @@ export const IncomingMailConfigCard: React.FC = () => {
|
||||
</div>
|
||||
<div>
|
||||
<label className={labelCls}>{t('email.incoming.security', 'Security')}</label>
|
||||
<select className={selectCls} value={cfg.imap_secure ? 'ssl' : 'plain'} onChange={(e) => set('imap_secure', e.target.value === 'ssl')}>
|
||||
<select className={selectCls} value={cfg.imap_secure ? 'ssl' : 'plain'} onChange={(e) => onSecurityChange(e.target.value)}>
|
||||
<option value="ssl">{t('email.incoming.ssl', 'SSL/TLS (993)')}</option>
|
||||
<option value="plain">{t('email.incoming.plain', 'None / STARTTLS (143)')}</option>
|
||||
</select>
|
||||
|
||||
Reference in New Issue
Block a user