Module: check_mk
Branch: master
Commit: 7b95345f179ee41ebd962d704e86b2e0268ab02e
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=7b95345f179ee4…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Jul 6 11:06:48 2015 +0200
WATO: Fixed an exception when creating a user
---
web/plugins/userdb/htpasswd.py | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/web/plugins/userdb/htpasswd.py b/web/plugins/userdb/htpasswd.py
index 122fe65..1a74fb1 100644
--- a/web/plugins/userdb/htpasswd.py
+++ b/web/plugins/userdb/htpasswd.py
@@ -27,6 +27,14 @@
import crypt
import defaults
+
+def encrypt_password(password, salt = None):
+ import md5crypt
+ if not salt:
+ salt = "%06d" % (1000000 * (time.time() % 1.0))
+ return md5crypt.md5crypt(password, salt, '$1$')
+
+
class HtpasswdUserConnector(UserConnector):
def __init__(self, config):
super(HtpasswdUserConnector, self).__init__(config)
@@ -75,13 +83,6 @@ class HtpasswdUserConnector(UserConnector):
return creds
- def encrypt_password(self, password, salt = None):
- import md5crypt
- if not salt:
- salt = "%06d" % (1000000 * (time.time() % 1.0))
- return md5crypt.md5crypt(password, salt, '$1$')
-
-
# Validate hashes taken from the htpasswd file. This method handles
# crypt() and md5 hashes. This should be the common cases in the
# used htpasswd files.