auth
This commit is contained in:
@@ -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(
|
||||
|
Reference in New Issue
Block a user