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

@ -575,7 +575,7 @@ const accounts = async () => {
' ',
dom.label(
style({display: 'inline-block'}),
dom.span('Account name', attr.title('An account has one or more email addresses, a password. Its messages and the message index database are are stored in the file system in a directory with the name of the account. An account name is not an email address. Use a name like a unix user name, or the localpart (the part before the "@") of the initial address.')),
dom.span('Account name', attr.title('An account has a password, and email address(es) (possibly at different domains). Its messages and the message index database are are stored in the file system in a directory with the name of the account. An account name is not an email address. Use a name like a unix user name, or the localpart (the part before the "@") of the initial address.')),
dom.br(),
account=dom.input(attr.required(''), function change() {
accountModified = true
@ -669,7 +669,8 @@ const account = async (name: string) => {
),
),
dom.tbody(
Object.keys(config.Destinations).map(k => {
Object.keys(config.Destinations || {}).length === 0 ? dom.tr(dom.td(attr.colspan('2'), '(None, login disabled)')) : [],
Object.keys(config.Destinations || {}).map(k => {
let v: ElemArg = k
const t = k.split('@')
if (t.length > 1) {