(mailbox) remove secondary email as required field

The secondary email address is no longer required for all creation
processes and we should not force the user to provide and store an
insecure email address.
This commit is contained in:
Sabrina Demagny
2025-04-08 22:14:08 +02:00
parent 99d7b23dc9
commit 7a1fc6b626
8 changed files with 89 additions and 32 deletions

View File

@@ -334,9 +334,6 @@ class DimailAPIClient:
last_name=dimail_mailbox["surName"],
local_part=address.username,
domain=domain,
secondary_email=dimail_mailbox["email"],
# secondary email is mandatory. Unfortunately, dimail doesn't
# store any. We temporarily give current email as secondary email.
status=enums.MailboxStatusChoices.ENABLED,
password=make_password(None), # unusable password
)
@@ -408,11 +405,18 @@ class DimailAPIClient:
mailbox.status = enums.MailDomainStatusChoices.ENABLED
mailbox.save()
# send confirmation email
self.notify_mailbox_creation(
recipient=mailbox.secondary_email,
mailbox_data=response.json(),
)
if mailbox.secondary_email:
# send confirmation email
self.notify_mailbox_creation(
recipient=mailbox.secondary_email,
mailbox_data=response.json(),
)
else:
logger.warning(
"Email notification for %s creation not sent "
"because no secondary email found",
mailbox,
)
def check_domain(self, domain):
"""Send a request to dimail to check domain health."""