mirror of
https://github.com/YunoHost/moulinette.git
synced 2024-09-03 20:06:31 +02:00
Merge branch 'dev' into 4.1
This commit is contained in:
commit
5feddfa93a
2 changed files with 15 additions and 11 deletions
|
@ -768,12 +768,15 @@ class Interface(BaseInterface):
|
||||||
|
|
||||||
# Attempt to retrieve and set locale
|
# Attempt to retrieve and set locale
|
||||||
def api18n(callback):
|
def api18n(callback):
|
||||||
try:
|
def wrapper(*args, **kwargs):
|
||||||
locale = request.params.pop("locale")
|
try:
|
||||||
except KeyError:
|
locale = request.params.pop("locale")
|
||||||
locale = m18n.default_locale
|
except KeyError:
|
||||||
m18n.set_locale(locale)
|
locale = m18n.default_locale
|
||||||
return callback
|
m18n.set_locale(locale)
|
||||||
|
return callback(*args, **kwargs)
|
||||||
|
|
||||||
|
return wrapper
|
||||||
|
|
||||||
# Install plugins
|
# Install plugins
|
||||||
app.install(filter_csrf)
|
app.install(filter_csrf)
|
||||||
|
|
|
@ -103,7 +103,6 @@ class LDAPServer:
|
||||||
|
|
||||||
ldap_interface.update("cn=admin", admin_dict)
|
ldap_interface.update("cn=admin", admin_dict)
|
||||||
|
|
||||||
|
|
||||||
def _hash_user_password(self, password):
|
def _hash_user_password(self, password):
|
||||||
"""
|
"""
|
||||||
Copy pasta of what's in yunohost/user.py
|
Copy pasta of what's in yunohost/user.py
|
||||||
|
@ -112,8 +111,10 @@ class LDAPServer:
|
||||||
import random
|
import random
|
||||||
import crypt
|
import crypt
|
||||||
|
|
||||||
char_set = string.ascii_uppercase + string.ascii_lowercase + string.digits + "./"
|
char_set = (
|
||||||
salt = ''.join([random.SystemRandom().choice(char_set) for x in range(16)])
|
string.ascii_uppercase + string.ascii_lowercase + string.digits + "./"
|
||||||
|
)
|
||||||
|
salt = "".join([random.SystemRandom().choice(char_set) for x in range(16)])
|
||||||
|
|
||||||
salt = '$6$' + salt + '$'
|
salt = "$6$" + salt + "$"
|
||||||
return '{CRYPT}' + crypt.crypt(str(password), salt)
|
return "{CRYPT}" + crypt.crypt(str(password), salt)
|
||||||
|
|
Loading…
Add table
Reference in a new issue