"Address already exists" when creating a new user, but user is created anyway
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
GNU Mailman |
Fix Released
|
High
|
Barry Warsaw |
Bug Description
When creating a new user via the REST API, if the email address exists, it reports "Address already exists", but it creates the user anyway.
After a bit of deep cave diving into the code I suspect it’s this in model/usermanag
This function appears to create a user before it checks to see if the address exists, with the result that multiple users are created when the address already exists.
@implementer(
class UserManager:
"""See `IUserManager`."""
def create_user(self, email=None, display_name=None):
"""See `IUserManager`."""
user = User(display_name, Preferences())
if email:
address = self.create_
return user
this seems to fix the problem - but please don’t trust my solution - needs verification.
@implementer(
class UserManager:
"""See `IUserManager`."""
def create_user(self, email=None, display_name=None):
"""See `IUserManager`."""
if email:
address = self.create_
user = User(display_name, Preferences())
if email:
return user
tags: | added: mailman3 |
Changed in mailman: | |
status: | In Progress → Fix Committed |
Changed in mailman: | |
status: | Fix Committed → Fix Released |
Your diagnosis and remedy is spot on! I will commit this fix with tests.