From 8ccc400a2bef9398414732d4571e75d8e2f649f8 Mon Sep 17 00:00:00 2001 From: Kauan Guesser Date: Mon, 30 Oct 2023 13:57:15 -0300 Subject: [PATCH] fix: await promise before check the result --- .../src/services/auth-local-validate-user.service.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/nestjs-auth-local/src/services/auth-local-validate-user.service.ts b/packages/nestjs-auth-local/src/services/auth-local-validate-user.service.ts index 348dc30f6..7d8b6a728 100644 --- a/packages/nestjs-auth-local/src/services/auth-local-validate-user.service.ts +++ b/packages/nestjs-auth-local/src/services/auth-local-validate-user.service.ts @@ -38,8 +38,10 @@ export class AuthLocalValidateUserService throw new Error(`No user found for username: ${dto.username}`); } + const isUserActive = await this.isActive(user); + // is the user active? - if (!this.isActive(user)) { + if (!isUserActive) { throw new Error(`User with username '${dto.username}' is inactive`); }