diff --git a/locales/en.json b/locales/en.json index 64a5e6bf3..50561cc80 100644 --- a/locales/en.json +++ b/locales/en.json @@ -501,6 +501,7 @@ "invalid_number": "Must be a number", "invalid_number_max": "Must be lesser than {max}", "invalid_number_min": "Must be greater than {min}", + "invalid_password": "Invalid password", "invalid_regex": "Invalid regex:'{regex}'", "invalid_shell": "Invalid shell: {shell}", "ip6tables_unavailable": "You cannot play with ip6tables here. You are either in a container or your kernel does not support it", @@ -561,6 +562,7 @@ "log_user_permission_update": "Update accesses for permission '{}'", "log_user_update": "Update info for user '{}'", "mail_alias_remove_failed": "Could not remove e-mail alias '{mail}'", + "mail_already_exists": "Mail adress '{mail}' already exists", "mail_domain_unknown": "Invalid e-mail address for domain '{domain}'. Please, use a domain administrated by this server.", "mail_forward_remove_failed": "Could not remove e-mail forwarding '{mail}'", "mail_unavailable": "This e-mail address is reserved for the admins group", diff --git a/src/portal.py b/src/portal.py index de852f5a6..ece555cd5 100644 --- a/src/portal.py +++ b/src/portal.py @@ -199,8 +199,10 @@ def portal_update( try: ldap_interface.validate_uniqueness({"mail": mail}) - except Exception as e: - raise YunohostError("user_update_failed", user=username, error=e) + except YunohostError: + raise YunohostValidationError( + "mail_already_exists", mail=mail, path=f"mailalias[{index}]" + ) if domain not in domains: raise YunohostValidationError(