mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #31375 -- Made contrib.auth.hashers.make_password() accept only bytes or strings.
This commit is contained in:
committed by
Mariusz Felisiak
parent
b3ab92cc5a
commit
8aa71f4e87
@@ -56,6 +56,11 @@ class TestUtilsHashPass(SimpleTestCase):
|
||||
self.assertIs(is_password_usable(encoded), True)
|
||||
self.assertIs(check_password(b'bytes_password', encoded), True)
|
||||
|
||||
def test_invalid_password(self):
|
||||
msg = 'Password must be a string or bytes, got int.'
|
||||
with self.assertRaisesMessage(TypeError, msg):
|
||||
make_password(1)
|
||||
|
||||
def test_pbkdf2(self):
|
||||
encoded = make_password('lètmein', 'seasalt', 'pbkdf2_sha256')
|
||||
self.assertEqual(encoded, 'pbkdf2_sha256$216000$seasalt$youGZxOw6ZOcfrXv2i8/AhrnpZflJJ9EshS9XmUJTUg=')
|
||||
|
||||
Reference in New Issue
Block a user