when removing an address, remove it as member from aliases

unless the address is the last member, then the admin must either remove the
alias first, or add new members. we don't want to accidentally remove an alias
address.

in the admin page for removing addresses, we warn the admin that the address
will be removed from any aliases.
This commit is contained in:
Mechiel Lukkien
2024-04-28 11:44:51 +02:00
parent e2924af8d2
commit 32cf6500bd
3 changed files with 41 additions and 4 deletions

View File

@ -837,7 +837,9 @@ const account = async (name: string) => {
dom.td(
dom.clickbutton('Remove', async function click(e: MouseEvent) {
e.preventDefault()
if (!window.confirm('Are you sure you want to remove this address?')) {
const aliases = (config.Aliases || []).filter(aa => aa.SubscriptionAddress === k).map(aa => aa.Alias.LocalpartStr+"@"+domainName(aa.Alias.Domain))
const aliasmsg = aliases.length > 0 ? ' Address will be removed from alias(es): '+aliases.join(', ') : ''
if (!window.confirm('Are you sure you want to remove this address?'+aliasmsg)) {
return
}
await check(e.target! as HTMLButtonElement, client.AddressRemove(k))
@ -1273,7 +1275,7 @@ const domain = async (d: string) => {
dom.td(
dom.clickbutton('Remove', async function click(e: MouseEvent) {
e.preventDefault()
if (!window.confirm('Are you sure you want to remove this address?')) {
if (!window.confirm('Are you sure you want to remove this address? If it is a member of an alias, it will be removed from the alias.')) {
return
}
await check(e.target! as HTMLButtonElement, client.AddressRemove(t[0] + '@' + d))