Fixed #26395 -- Skipped the CryptPasswordHasher tests on platforms with a dummy crypt module.
This commit is contained in:
parent
5ca08f7cab
commit
1243fdf5cb
|
@ -602,6 +602,7 @@ class CryptPasswordHasher(BasePasswordHasher):
|
||||||
crypt = self._load_library()
|
crypt = self._load_library()
|
||||||
assert len(salt) == 2
|
assert len(salt) == 2
|
||||||
data = crypt.crypt(force_str(password), salt)
|
data = crypt.crypt(force_str(password), salt)
|
||||||
|
assert data is not None # A platform like OpenBSD with a dummy crypt module.
|
||||||
# we don't need to store the salt, but Django used to do this
|
# we don't need to store the salt, but Django used to do this
|
||||||
return "%s$%s$%s" % (self.algorithm, '', data)
|
return "%s$%s$%s" % (self.algorithm, '', data)
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,10 @@ try:
|
||||||
import crypt
|
import crypt
|
||||||
except ImportError:
|
except ImportError:
|
||||||
crypt = None
|
crypt = None
|
||||||
|
else:
|
||||||
|
# On some platforms (e.g. OpenBSD), crypt.crypt() always return None.
|
||||||
|
if crypt.crypt('', '') is None:
|
||||||
|
crypt = None
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import bcrypt
|
import bcrypt
|
||||||
|
|
Loading…
Reference in New Issue