✨(mailboxes) manage bad secret sent to dimail API
- manage 403 returned by dimail API when mail domain secret is not valid - improve some tests - improve MailboxFactory to mock success for dimail API POST call - override 403.html to return a nice failing error in django admin - an error message is displayed on mailbox creation form of frontend
This commit is contained in:
@@ -84,5 +84,12 @@ class DimailAPIClient:
|
||||
mailbox.domain.name,
|
||||
extra=extra,
|
||||
)
|
||||
|
||||
elif response.status_code == status.HTTP_403_FORBIDDEN:
|
||||
logger.error(
|
||||
"[DIMAIL] 403 Forbidden: please check the mail domain secret of %s",
|
||||
mailbox.domain.name,
|
||||
)
|
||||
raise exceptions.PermissionDenied(
|
||||
f"Please check secret of the mail domain {mailbox.domain.name}"
|
||||
)
|
||||
return response
|
||||
|
||||
Reference in New Issue
Block a user