🚸(mailboxes) improve error message when no secondary email

improve error message when trying to reset password on a
mailbox not having a secondary email.
This commit is contained in:
Marie PUPO JEAMMET
2026-03-16 18:14:43 +01:00
committed by Marie
parent 6c8ded9904
commit 06dcdf275a
4 changed files with 8 additions and 4 deletions

View File

@@ -15,6 +15,7 @@ and this project adheres to
### Fixed
- 🐛(dimail) fix no import for functional mailboxes
- 🚸(mailboxes) improve error message when no secondary email
## [1.24.0] - 2026-03-24

View File

@@ -75,8 +75,7 @@ def test_api_mailboxes__reset_password_no_secondary_email():
client = APIClient()
client.force_login(access.user)
error = "Password reset requires a secondary email address. \
Please add a valid secondary email before trying again."
error = "Please add a secondary email before resetting the password."
# Mailbox with no secondary email
mailbox = factories.MailboxEnabledFactory(domain=mail_domain, secondary_email=None)

View File

@@ -652,7 +652,7 @@ class DimailAPIClient:
"""Send a request to reset mailbox password."""
if not mailbox.secondary_email or mailbox.secondary_email == str(mailbox):
raise exceptions.ValidationError(
"Password reset requires a secondary email address. Please add a valid secondary email before trying again."
_("Please add a secondary email before resetting the password.")
)
try:

View File

@@ -67,7 +67,11 @@ export const PanelActions = ({ mailDomain, mailbox }: PanelActionsProps) => {
{
onSuccess: () =>
toast(t('Successfully reset password.'), VariantType.SUCCESS),
onError: () => toast(t('Failed to reset password'), VariantType.ERROR),
onError: (error) =>
toast(
t(error.cause?.[0] || 'Failed to reset password'),
VariantType.ERROR,
),
},
);
};