This commit is contained in:
2024-04-04 10:51:51 +00:00
parent b04eba9bc4
commit f8f5bf80c1
6 changed files with 74 additions and 37 deletions

View File

@@ -15,12 +15,16 @@ class LoginUser:
self.hasher = password_hasher
async def __call__(self, request: LoginRequest) -> AuthenticationResponse:
print("__call__ request", request)
user = await self.user_repository.get_user(filter={"email": request.email})
print("__call__ user from repo", user)
error = UserInvalidCredentialsError("Email or password is incorrect")
if user is None:
print("user is none in LoginUser __call__")
raise error
if not self.hasher.verify_password(request.password, user.hashed_password):
print("wrong pass in LoginUser __call__")
raise error
return AuthenticationResponse(