From 5dd0cb0b5185ffc2feea13bfacad69e80d4d84d0 Mon Sep 17 00:00:00 2001 From: H4CK3R-01 Date: Sun, 27 Mar 2022 21:21:20 +0200 Subject: [PATCH] Fixed binary is not serializable error #2 --- api/api_blueprint_user.py | 2 +- api/helper_functions.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/api/api_blueprint_user.py b/api/api_blueprint_user.py index 0afd873..1a6bccc 100644 --- a/api/api_blueprint_user.py +++ b/api/api_blueprint_user.py @@ -56,7 +56,7 @@ def login(data): if query_user is None: # email doesn't exist abort(500, message="Unable to login") - if not check_password(query_user.password, password): # Password incorrect + if not check_password(query_user.password, password.encode("utf-8")): # Password incorrect abort(500, message="Unable to login") token = jwt.encode({'email': query_user.email, 'exp': datetime.datetime.utcnow() + datetime.timedelta(minutes=45)}, os.getenv('SECRET_KEY'), "HS256") diff --git a/api/helper_functions.py b/api/helper_functions.py index d805602..3d59264 100644 --- a/api/helper_functions.py +++ b/api/helper_functions.py @@ -14,7 +14,7 @@ def hash_password(password): def check_password(hashed_password, user_password): - return bcrypt.checkpw(hashed_password.encode("utf-8"), user_password) + return bcrypt.checkpw(user_password, hashed_password) def get_token():