mirror of
https://github.com/YunoHost/moulinette.git
synced 2024-09-03 20:06:31 +02:00
[fix] handle post-install
This commit is contained in:
parent
2d4018c82c
commit
6aa22000cd
1 changed files with 6 additions and 2 deletions
|
@ -96,10 +96,14 @@ class Authenticator(BaseAuthenticator):
|
||||||
return '{CRYPT}' + crypt.crypt(str(password), salt)
|
return '{CRYPT}' + crypt.crypt(str(password), salt)
|
||||||
|
|
||||||
hashed_password = self.search("cn=admin,dc=yunohost,dc=org",
|
hashed_password = self.search("cn=admin,dc=yunohost,dc=org",
|
||||||
attrs=["userPassword"])[0]["userPassword"][0]
|
attrs=["userPassword"])[0]
|
||||||
|
|
||||||
|
# post-install situation, password is not already set
|
||||||
|
if "userPassword" not in hashed_password or not hashed_password["userPassword"]:
|
||||||
|
return
|
||||||
|
|
||||||
# we aren't using sha-512 but something else that is weaker, proceed to upgrade
|
# we aren't using sha-512 but something else that is weaker, proceed to upgrade
|
||||||
if not hashed_password.startswith("{CRYPT}$6$"):
|
if not hashed_password["userPassword"][0].startswith("{CRYPT}$6$"):
|
||||||
self.update("cn=admin", {
|
self.update("cn=admin", {
|
||||||
"userPassword": _hash_user_password(password),
|
"userPassword": _hash_user_password(password),
|
||||||
})
|
})
|
||||||
|
|
Loading…
Add table
Reference in a new issue