Skip to content

Commit

Permalink
feat: throw bad credentials when user not found
Browse files Browse the repository at this point in the history
  • Loading branch information
SmartNetAR committed Mar 23, 2022
1 parent 84885d2 commit a206f29
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Auth/Domain/UseCases/LoginUseCase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,12 @@ class LoginUseCase
{
const email = payload.email;
const password = payload.password;
const user = await this.repository.getOneByEmail(email);
const user = await this.repository.getOneBy({ email }, { populate: 'roles', initThrow: false });

if (!user)
{
throw new BadCredentialsException();
}

if (!user.verify)
{
Expand Down

0 comments on commit a206f29

Please sign in to comment.