Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Avoid attribute error when password_config present but empty (#6753)
Browse files Browse the repository at this point in the history
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: Ivan Vilata i Balaguer <ivan@selidor.net>
  • Loading branch information
ivilata authored and richvdh committed Jan 22, 2020
1 parent 07124d0 commit 837f622
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions changelog.d/6753.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix `AttributeError: 'NoneType' object has no attribute 'get'` in `hash_password` when configuration has an empty `password_config`. Contributed by @ivilata.
2 changes: 1 addition & 1 deletion scripts/hash_password
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 837f622

Please sign in to comment.