[Bug 1418280] [NEW] "Address already exists" when creating a new user, but user is created anyway
Public bug reported: 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/usermanager.py 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(IUserManager) 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_address(email, display_name) user.link(address) return user this seems to fix the problem - but please don’t trust my solution - needs verification. @implementer(IUserManager) class UserManager: """See `IUserManager`.""" def create_user(self, email=None, display_name=None): """See `IUserManager`.""" if email: address = self.create_address(email, display_name) user = User(display_name, Preferences()) if email: user.link(address) return user ** Affects: mailman Importance: Undecided Status: New -- You received this bug notification because you are a member of Mailman Coders, which is subscribed to GNU Mailman. https://bugs.launchpad.net/bugs/1418280 Title: "Address already exists" when creating a new user, but user is created anyway To manage notifications about this bug go to: https://bugs.launchpad.net/mailman/+bug/1418280/+subscriptions
** Tags added: mailman3 -- You received this bug notification because you are a member of Mailman Coders, which is subscribed to GNU Mailman. https://bugs.launchpad.net/bugs/1418280 Title: "Address already exists" when creating a new user, but user is created anyway To manage notifications about this bug go to: https://bugs.launchpad.net/mailman/+bug/1418280/+subscriptions
Your diagnosis and remedy is spot on! I will commit this fix with tests. ** Changed in: mailman Status: New => Confirmed ** Changed in: mailman Importance: Undecided => High ** Changed in: mailman Assignee: (unassigned) => Barry Warsaw (barry) ** Changed in: mailman Milestone: None => 3.0.0b6 ** Changed in: mailman Status: Confirmed => In Progress -- You received this bug notification because you are a member of Mailman Coders, which is subscribed to GNU Mailman. https://bugs.launchpad.net/bugs/1418280 Title: "Address already exists" when creating a new user, but user is created anyway To manage notifications about this bug go to: https://bugs.launchpad.net/mailman/+bug/1418280/+subscriptions
** Changed in: mailman Status: In Progress => Fix Committed -- You received this bug notification because you are a member of Mailman Coders, which is subscribed to GNU Mailman. https://bugs.launchpad.net/bugs/1418280 Title: "Address already exists" when creating a new user, but user is created anyway To manage notifications about this bug go to: https://bugs.launchpad.net/mailman/+bug/1418280/+subscriptions
** Changed in: mailman Status: Fix Committed => Fix Released -- You received this bug notification because you are a member of Mailman Coders, which is subscribed to GNU Mailman. https://bugs.launchpad.net/bugs/1418280 Title: "Address already exists" when creating a new user, but user is created anyway To manage notifications about this bug go to: https://bugs.launchpad.net/mailman/+bug/1418280/+subscriptions
participants (2)
-
Andrew Stuart
-
Barry Warsaw