Fix HTTP 500 on missing email or domain when creating users and aliases
If the email or domain field was missing or invalid, the error was flashed, but the address was still built from the unset attributes, which raised an AttributeError. Only build and validate the address if both are set. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
4a03b5c1a1
commit
80757fa1d8
2 files changed
+2
No files matched your search
@@ -39,6 +39,7 @@ class AliasCreate(
|
||||
else:
|
||||
self.domain = self.get_user_domain()
|
||||
|
||||
if not error:
|
||||
full_email = f"{self.email}@{self.domain}"
|
||||
if not self.is_email_valid(full_email):
|
||||
error = True
|
||||
|
||||
@@ -32,6 +32,7 @@ class UserCreate(AllowAdmin, CheckEmailMixin, BackToUsersMixin, BaseTemplateGetV
|
||||
else:
|
||||
self.domain = domain
|
||||
|
||||
if not error:
|
||||
full_email = f"{self.email}@{self.domain}"
|
||||
if not self.is_email_valid(full_email):
|
||||
error = True
|
||||
|
||||
Reference in new issue
Block a user