Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed #21627 -- Added unicode_literals to changepassword command.

Fixed a crash when executing changepassword command when the user object
representation contained non-ASCII characters.
  • Loading branch information...
commit 398642fd9b6e9b4d83baed7b9708ca0cd942540b 1 parent 318cdc0
@jonklo jonklo authored timgraham committed
View
2  django/contrib/auth/management/commands/changepassword.py
@@ -1,3 +1,5 @@
+from __future__ import unicode_literals
+
import getpass
from optparse import make_option
View
12 django/contrib/auth/tests/test_management.py
@@ -82,6 +82,18 @@ def test_that_max_tries_exits_1(self):
with self.assertRaises(CommandError):
command.execute("joe", stdout=self.stdout, stderr=self.stderr)
+ def test_that_changepassword_command_works_with_nonascii_output(self):
+ """
+ #21627 -- Executing the changepassword management command should allow
+ non-ASCII characters from the User object representation.
+ """
+ # 'Julia' with accented 'u':
+ models.User.objects.create_user(username='J\xfalia', password='qwerty')
+
+ command = changepassword.Command()
+ command._get_pass = lambda *args: 'not qwerty'
+
+ command.execute("J\xfalia", stdout=self.stdout)
@skipIfCustomUser
class CreatesuperuserManagementCommandTestCase(TestCase):
View
3  docs/releases/1.6.2.txt
@@ -11,3 +11,6 @@ Bug fixes
* Prevented the base geometry object of a prepared geometry to be garbage
collected, which could lead to crash Django (#21662).
+
+* Fixed a crash when executing the :djadmin:`changepassword` command when the
+ user object representation contained non-ASCII characters (#21627).
Please sign in to comment.
Something went wrong with that request. Please try again.