From 807fa0d61265bfd70dcf6dc1a3b19cea506e5d2e Mon Sep 17 00:00:00 2001 From: Marcin Piela Date: Fri, 10 May 2024 14:31:35 +0200 Subject: [PATCH] [EXD-39] Validation of user status during authentication --- src/auth/auth.service.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/auth/auth.service.ts b/src/auth/auth.service.ts index 63f6089..e311238 100644 --- a/src/auth/auth.service.ts +++ b/src/auth/auth.service.ts @@ -16,6 +16,9 @@ export class AuthService { async validateUser(email: string, displayName: string) { const user = await this.userRepo.findOne({ where: { email: email } }); + if (!user?.isEnabled) { + return null; + } if (user) { return user; @@ -34,6 +37,9 @@ export class AuthService { async findUser(id: string) { const user = await this.userRepo.findOne({ where: { id } }); + if (!user?.isEnabled) { + return null; + } return user?.id || null; } }