Call assert_no_such_user before assert_valid_password.

This commit is contained in:
voussoir 2020-09-19 03:35:26 -07:00
parent 7b7015125e
commit 1013fb81c1

View file

@ -1330,12 +1330,12 @@ class PDBUserMixin:
def new_user(self, username, password, *, display_name=None): def new_user(self, username, password, *, display_name=None):
# These might raise exceptions. # These might raise exceptions.
self.assert_valid_username(username) self.assert_valid_username(username)
self.assert_no_such_user(username=username)
if not isinstance(password, bytes): if not isinstance(password, bytes):
password = password.encode('utf-8') password = password.encode('utf-8')
self.assert_valid_password(password) self.assert_valid_password(password)
self.assert_no_such_user(username=username)
display_name = objects.User.normalize_display_name( display_name = objects.User.normalize_display_name(
display_name, display_name,