diff --git a/django/contrib/auth/management/commands/changepassword.py b/django/contrib/auth/management/commands/changepassword.py index 600911f7592..162d08a3a91 100644 --- a/django/contrib/auth/management/commands/changepassword.py +++ b/django/contrib/auth/management/commands/changepassword.py @@ -60,7 +60,7 @@ class Command(BaseCommand): try: validate_password(p2, u) except ValidationError as err: - self.stdout.write(', '.join(err.messages)) + self.stderr.write('\n'.join(err.messages)) count += 1 else: password_validated = True diff --git a/django/contrib/auth/management/commands/createsuperuser.py b/django/contrib/auth/management/commands/createsuperuser.py index 56461cedfab..58364ec543e 100644 --- a/django/contrib/auth/management/commands/createsuperuser.py +++ b/django/contrib/auth/management/commands/createsuperuser.py @@ -153,7 +153,7 @@ class Command(BaseCommand): try: validate_password(password2, self.UserModel(**fake_user_data)) except exceptions.ValidationError as err: - self.stderr.write(', '.join(err.messages)) + self.stderr.write('\n'.join(err.messages)) password = None except KeyboardInterrupt: diff --git a/tests/auth_tests/test_management.py b/tests/auth_tests/test_management.py index 70d5ceac5be..435bc9e1e5e 100644 --- a/tests/auth_tests/test_management.py +++ b/tests/auth_tests/test_management.py @@ -160,7 +160,7 @@ class ChangepasswordManagementCommandTestCase(TestCase): abort_msg = "Aborting password change for user 'joe' after 3 attempts" with self.assertRaisesMessage(CommandError, abort_msg): command.execute(username="joe", stdout=self.stdout, stderr=self.stderr) - self.assertIn('This password is entirely numeric.', self.stdout.getvalue()) + self.assertIn('This password is entirely numeric.', self.stderr.getvalue()) def test_that_changepassword_command_works_with_nonascii_output(self): """