diff options
author | Kent Shikama <kent@kentshikama.com> | 2016-07-05 19:12:53 +0900 |
---|---|---|
committer | Kent Shikama <kent@kentshikama.com> | 2016-07-05 19:12:53 +0900 |
commit | 14362bf3590eb95a50201a84c8e16d5626b86249 (patch) | |
tree | 0199e01da5c5b9b48c5d9bb1bf35db2540b0dcde | |
parent | Fix pep8 (diff) | |
download | synapse-14362bf3590eb95a50201a84c8e16d5626b86249.tar.xz |
Fix password config
-rw-r--r-- | synapse/config/password.py | 2 | ||||
-rw-r--r-- | synapse/handlers/auth.py | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/synapse/config/password.py b/synapse/config/password.py index 058a3a5346..00b1ea3df9 100644 --- a/synapse/config/password.py +++ b/synapse/config/password.py @@ -23,7 +23,7 @@ class PasswordConfig(Config): def read_config(self, config): password_config = config.get("password_config", {}) self.password_enabled = password_config.get("enabled", True) - self.pepper = password_config.get("pepper", "") + self.password_pepper = password_config.get("pepper", "") def default_config(self, config_dir_path, server_name, **kwargs): return """ diff --git a/synapse/handlers/auth.py b/synapse/handlers/auth.py index be46681c64..e259213a36 100644 --- a/synapse/handlers/auth.py +++ b/synapse/handlers/auth.py @@ -750,7 +750,7 @@ class AuthHandler(BaseHandler): Returns: Hashed password (str). """ - return bcrypt.hashpw(password + self.hs.config.password_config.pepper, + return bcrypt.hashpw(password + self.hs.config.password_pepper, bcrypt.gensalt(self.bcrypt_rounds)) def validate_hash(self, password, stored_hash): @@ -764,7 +764,7 @@ class AuthHandler(BaseHandler): Whether self.hash(password) == stored_hash (bool). """ if stored_hash: - return bcrypt.hashpw(password + self.hs.config.password_config.pepper, + return bcrypt.hashpw(password + self.hs.config.password_pepper, stored_hash.encode('utf-8')) == stored_hash else: return False |