From 280840def31b772cac83b7081d27892f19e4eb1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlota=20Catot=20Brag=C3=B3s?= Date: Tue, 2 Jan 2024 15:48:16 +0100 Subject: [PATCH] [ORG-42] Fix endpoint (#55) * add bcrypt * update the login and register endpoint * fix mypy, black and other things * migrations * fix endpoint --- organizator_api/app/users/domain/usecases/login_use_case.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/organizator_api/app/users/domain/usecases/login_use_case.py b/organizator_api/app/users/domain/usecases/login_use_case.py index 73e95007..0904bf53 100644 --- a/organizator_api/app/users/domain/usecases/login_use_case.py +++ b/organizator_api/app/users/domain/usecases/login_use_case.py @@ -14,7 +14,8 @@ def execute(self, username: str, password: str) -> uuid.UUID: if user.token is not None: return user.token - if bcrypt.checkpw(password.encode("utf-8"), user.password) is False: + check = bcrypt.checkpw(password.encode("utf-8"), bytes(user.password)) + if not check: raise InvalidPassword user.token = uuid.uuid4()