for aliases, enable "public posting" by default when creating an alias

and explain in more detail what it means in the webadmin interface.
will hopefully bring less confusion.

for issue #244 by exander77, thanks for reporting
This commit is contained in:
Mechiel Lukkien 2024-11-10 22:19:02 +01:00
parent c13f1814fc
commit 0e338b0530
No known key found for this signature in database
4 changed files with 8 additions and 7 deletions

2
doc.go
View file

@ -1008,7 +1008,7 @@ Print settings and members of alias.
# mox config alias add # mox config alias add
Add new alias with one or more addresses. Add new alias with one or more addresses and public posting enabled.
usage: mox config alias add alias@domain rcpt1@domain ... usage: mox config alias add alias@domain rcpt1@domain ...

View file

@ -770,13 +770,13 @@ func ctlcmdConfigAliasPrint(ctl *ctl, address string) {
func cmdConfigAliasAdd(c *cmd) { func cmdConfigAliasAdd(c *cmd) {
c.params = "alias@domain rcpt1@domain ..." c.params = "alias@domain rcpt1@domain ..."
c.help = `Add new alias with one or more addresses.` c.help = `Add new alias with one or more addresses and public posting enabled.`
args := c.Parse() args := c.Parse()
if len(args) < 2 { if len(args) < 2 {
c.Usage() c.Usage()
} }
alias := config.Alias{Addresses: args[1:]} alias := config.Alias{PostPublic: true, Addresses: args[1:]}
mustLoadConfig() mustLoadConfig()
ctlcmdConfigAliasAdd(xctl(), args[0], alias) ctlcmdConfigAliasAdd(xctl(), args[0], alias)

View file

@ -2358,7 +2358,7 @@ const domain = async (d) => {
e.stopPropagation(); e.stopPropagation();
const alias = { const alias = {
Addresses: aliasAddresses.value.split('\n').map(s => s.trim()).filter(s => !!s), Addresses: aliasAddresses.value.split('\n').map(s => s.trim()).filter(s => !!s),
PostPublic: false, PostPublic: true,
ListMembers: false, ListMembers: false,
AllowMsgFrom: false, AllowMsgFrom: false,
// Ignored: // Ignored:
@ -2554,7 +2554,7 @@ const domainAlias = async (d, aliasLocalpart) => {
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
check(aliasFieldset, client.AliasUpdate(aliasLocalpart, d, postPublic.checked, listMembers.checked, allowMsgFrom.checked)); check(aliasFieldset, client.AliasUpdate(aliasLocalpart, d, postPublic.checked, listMembers.checked, allowMsgFrom.checked));
}, aliasFieldset = dom.fieldset(style({ display: 'flex', flexDirection: 'column', gap: '.5ex' }), dom.label(postPublic = dom.input(attr.type('checkbox'), alias.PostPublic ? attr.checked('') : []), ' Public, anyone can post instead of only members'), dom.label(listMembers = dom.input(attr.type('checkbox'), alias.ListMembers ? attr.checked('') : []), ' Members can list other members'), dom.label(allowMsgFrom = dom.input(attr.type('checkbox'), alias.AllowMsgFrom ? attr.checked('') : []), ' Allow messages to use the alias address in the message From header'), dom.div(style({ marginTop: '1ex' }), dom.submitbutton('Save')))), dom.br(), dom.h2('Members'), dom.p('Members receive messages sent to the alias. If a member address is in the message From header, the member will not receive the message.'), dom.table(dom.thead(dom.tr(dom.th('Address'), dom.th('Account'), dom.th())), dom.tbody((alias.Addresses || []).map((address, index) => { }, aliasFieldset = dom.fieldset(style({ display: 'flex', flexDirection: 'column', gap: '.5ex' }), dom.label(postPublic = dom.input(attr.type('checkbox'), alias.PostPublic ? attr.checked('') : []), ' Public, anyone is allowed to send to the alias, instead of only members of the alias', attr.title('Based on address in message From header, which is assumed to be DMARC-like verified. If this setting is disabled and a non-member sends a message to the alias, the message is rejected.')), dom.label(listMembers = dom.input(attr.type('checkbox'), alias.ListMembers ? attr.checked('') : []), ' Members can list other members'), dom.label(allowMsgFrom = dom.input(attr.type('checkbox'), alias.AllowMsgFrom ? attr.checked('') : []), ' Allow messages to use the alias address in the message From header'), dom.div(style({ marginTop: '1ex' }), dom.submitbutton('Save')))), dom.br(), dom.h2('Members'), dom.p('Members receive messages sent to the alias. If a member address is in the message From header, the member will not receive the message.'), dom.table(dom.thead(dom.tr(dom.th('Address'), dom.th('Account'), dom.th())), dom.tbody((alias.Addresses || []).map((address, index) => {
const pa = (alias.ParsedAddresses || [])[index]; const pa = (alias.ParsedAddresses || [])[index];
return dom.tr(dom.td(prewrap(address)), dom.td(dom.a(pa.AccountName, attr.href('#accounts/' + pa.AccountName))), dom.td(dom.clickbutton('Remove', async function click(e) { return dom.tr(dom.td(prewrap(address)), dom.td(dom.a(pa.AccountName, attr.href('#accounts/' + pa.AccountName))), dom.td(dom.clickbutton('Remove', async function click(e) {
await check(e.target, client.AliasAddressesRemove(aliasLocalpart, d, [address])); await check(e.target, client.AliasAddressesRemove(aliasLocalpart, d, [address]));

View file

@ -1347,7 +1347,7 @@ const domain = async (d: string) => {
e.stopPropagation() e.stopPropagation()
const alias: api.Alias = { const alias: api.Alias = {
Addresses: aliasAddresses.value.split('\n').map(s => s.trim()).filter(s => !!s), Addresses: aliasAddresses.value.split('\n').map(s => s.trim()).filter(s => !!s),
PostPublic: false, PostPublic: true,
ListMembers: false, ListMembers: false,
AllowMsgFrom: false, AllowMsgFrom: false,
// Ignored: // Ignored:
@ -1814,7 +1814,8 @@ const domainAlias = async (d: string, aliasLocalpart: string) => {
style({display: 'flex', flexDirection: 'column', gap: '.5ex'}), style({display: 'flex', flexDirection: 'column', gap: '.5ex'}),
dom.label( dom.label(
postPublic=dom.input(attr.type('checkbox'), alias.PostPublic ? attr.checked('') : []), postPublic=dom.input(attr.type('checkbox'), alias.PostPublic ? attr.checked('') : []),
' Public, anyone can post instead of only members', ' Public, anyone is allowed to send to the alias, instead of only members of the alias',
attr.title('Based on address in message From header, which is assumed to be DMARC-like verified. If this setting is disabled and a non-member sends a message to the alias, the message is rejected.'),
), ),
dom.label( dom.label(
listMembers=dom.input(attr.type('checkbox'), alias.ListMembers ? attr.checked('') : []), listMembers=dom.input(attr.type('checkbox'), alias.ListMembers ? attr.checked('') : []),