Skip to content
Snippets Groups Projects
Commit 837f6226 authored by Ivan Vilata-i-Balaguer's avatar Ivan Vilata-i-Balaguer Committed by Richard van der Hoff
Browse files

Avoid attribute error when `password_config` present but empty (#6753)


The old statement returned `None` for such a `password_config` (like the one
created on first run), thus retrieval of the `pepper` key failed with
`AttributeError`.

Fixes #5315

Signed-off-by: default avatarIvan Vilata i Balaguer <ivan@selidor.net>
parent 07124d02
No related merge requests found
Fix `AttributeError: 'NoneType' object has no attribute 'get'` in `hash_password` when configuration has an empty `password_config`. Contributed by @ivilata.
......@@ -52,7 +52,7 @@ if __name__ == "__main__":
if "config" in args and args.config:
config = yaml.safe_load(args.config)
bcrypt_rounds = config.get("bcrypt_rounds", bcrypt_rounds)
password_config = config.get("password_config", {})
password_config = config.get("password_config", None) or {}
password_pepper = password_config.get("pepper", password_pepper)
password = args.password
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment