mirror of
https://github.com/YunoHost/moulinette.git
synced 2024-09-03 20:06:31 +02:00
Let's hash the password like we do in core during tests
This commit is contained in:
parent
e49a47c7f5
commit
0c78374ed4
2 changed files with 17 additions and 1 deletions
|
@ -98,7 +98,22 @@ class LDAPServer:
|
||||||
"posixAccount",
|
"posixAccount",
|
||||||
"simpleSecurityObject",
|
"simpleSecurityObject",
|
||||||
],
|
],
|
||||||
"userPassword": ["yunohost"],
|
"userPassword": [self._hash_user_password("yunohost")],
|
||||||
}
|
}
|
||||||
|
|
||||||
ldap_interface.update("cn=admin", admin_dict)
|
ldap_interface.update("cn=admin", admin_dict)
|
||||||
|
|
||||||
|
|
||||||
|
def _hash_user_password(self, password):
|
||||||
|
"""
|
||||||
|
Copy pasta of what's in yunohost/user.py
|
||||||
|
"""
|
||||||
|
import string
|
||||||
|
import random
|
||||||
|
import crypt
|
||||||
|
|
||||||
|
char_set = string.ascii_uppercase + string.ascii_lowercase + string.digits + "./"
|
||||||
|
salt = ''.join([random.SystemRandom().choice(char_set) for x in range(16)])
|
||||||
|
|
||||||
|
salt = '$6$' + salt + '$'
|
||||||
|
return '{CRYPT}' + crypt.crypt(str(password), salt)
|
||||||
|
|
1
tox.ini
1
tox.ini
|
@ -19,6 +19,7 @@ deps =
|
||||||
gevent-websocket
|
gevent-websocket
|
||||||
bottle >= 0.12
|
bottle >= 0.12
|
||||||
WebTest >= 2.0, < 2.1
|
WebTest >= 2.0, < 2.1
|
||||||
|
python-ldap >= 3.1.0
|
||||||
commands =
|
commands =
|
||||||
pytest {posargs}
|
pytest {posargs}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue