allow zero configured addresses for an account

preventing writing out a domains.conf that is invalid and can't be parsed
again. this happens when the last address was removed from an account. just a
click in the admin web interface.

accounts without email address cannot log in.

for issue #133 by ally9335
This commit is contained in:
Mechiel Lukkien
2024-03-09 11:51:02 +01:00
parent 92e0d2a682
commit 7969cf002a
6 changed files with 23 additions and 19 deletions

View File

@ -341,7 +341,8 @@ const index = async () => {
dom.h2('Addresses'),
dom.ul(
Object.entries(destinations).sort().map(t =>
Object.entries(destinations || {}).length === 0 ? dom.li('(None, login disabled)') : [],
Object.entries(destinations || {}).sort().map(t =>
dom.li(
dom.a(t[0], attr.href('#destinations/'+t[0])),
t[0].startsWith('@') ? ' (catchall)' : [],
@ -689,7 +690,7 @@ const destination = async (name: string) => {
let fullName: HTMLInputElement
let saveButton: HTMLButtonElement
const addresses = [name, ...Object.keys(destinations).filter(a => !a.startsWith('@') && a !== name)]
const addresses = [name, ...Object.keys(destinations || {}).filter(a => !a.startsWith('@') && a !== name)]
dom._kids(page,
crumbs(