Call assert_no_such_user before assert_valid_password.
This commit is contained in:
parent
7b7015125e
commit
1013fb81c1
1 changed files with 1 additions and 1 deletions
|
@ -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,
|
||||||
|
|
Loading…
Reference in a new issue