diff --git a/apps/web/src/app/(app)/einstellungen/email/page.tsx b/apps/web/src/app/(app)/einstellungen/email/page.tsx index b44c518..65517cf 100644 --- a/apps/web/src/app/(app)/einstellungen/email/page.tsx +++ b/apps/web/src/app/(app)/einstellungen/email/page.tsx @@ -20,11 +20,12 @@ function SmtpForm({ s, w, onSaved }: { s: Settings; w: boolean; onSaved: () => v const [testTo, setTestTo] = useState(''); const [testBusy, setTestBusy] = useState(false); async function save(e: FormEvent) { e.preventDefault(); if (!w) return; setBusy(true); setMsg(null); - const f = new FormData(e.currentTarget); const v = (k: string) => (String(f.get(k) ?? '').trim() || null); + const form = e.currentTarget; + const f = new FormData(form); const v = (k: string) => (String(f.get(k) ?? '').trim() || null); const pw = String(f.get('password') ?? ''); try { await api('PUT', '/admin/email/settings', { host: v('host'), port: Number(f.get('port')) || 587, secureMode: f.get('secureMode'), username: v('username'), fromName: v('fromName'), fromEmail: v('fromEmail'), ...(pw ? { password: pw } : {}) }); - setMsg({ k: 'ok', t: 'Gespeichert.' }); (e.currentTarget.elements.namedItem('password') as HTMLInputElement).value = ''; onSaved(); + setMsg({ k: 'ok', t: 'Gespeichert.' }); (form.elements.namedItem('password') as HTMLInputElement).value = ''; onSaved(); } catch (x) { setMsg({ k: 'err', t: errMsg(x) }); } finally { setBusy(false); } } async function sendTest() {