aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBonfaceKilz2020-10-20 22:55:38 +0300
committerBonfaceKilz2020-10-20 22:55:38 +0300
commitb94060ef1fa07cb072593f7085b8cd0be5874dca (patch)
treecbda392a08124c8f795b9a571c330fe48869c8a9
parent5d06524c8465064248cc3605c69dd32687ea7565 (diff)
downloadgenenetwork2-b94060ef1fa07cb072593f7085b8cd0be5874dca.tar.gz
Update how pbkdf2.pbkdf2_hex is used when encrypting pass
* wqflask/wqflask/user_login.py (encode_password): - Remove unused local variable "salt". - Pass "hashfunc" as a string. - Apply Pep-8.
-rw-r--r--wqflask/wqflask/user_login.py12
1 files changed, 5 insertions, 7 deletions
diff --git a/wqflask/wqflask/user_login.py b/wqflask/wqflask/user_login.py
index cb2edbc5..f25ebc32 100644
--- a/wqflask/wqflask/user_login.py
+++ b/wqflask/wqflask/user_login.py
@@ -37,15 +37,13 @@ def basic_info():
ip_address = request.remote_addr,
user_agent = request.headers.get('User-Agent'))
-def encode_password(pass_gen_fields, unencrypted_password):
- hashfunc = getattr(hashlib, pass_gen_fields['hashfunc'])
- salt = base64.b64decode(pass_gen_fields['salt'])
+def encode_password(pass_gen_fields, unencrypted_password):
encrypted_password = pbkdf2.pbkdf2_hex(str(unencrypted_password),
- pass_gen_fields['salt'],
- pass_gen_fields['iterations'],
- pass_gen_fields['keylength'],
- hashfunc)
+ pass_gen_fields['salt'],
+ pass_gen_fields['iterations'],
+ pass_gen_fields['keylength'],
+ pass_gen_fields['hashfunc'])
pass_gen_fields.pop("unencrypted_password", None)
pass_gen_fields["password"] = encrypted_password