Skip to content

Commit

Permalink
Merge pull request #5 from Excali-Studio/EXD-39-validate-if-user-enabled
Browse files Browse the repository at this point in the history
[EXD-39] Validation of user status during authentication
  • Loading branch information
marcin-piela-ssh authored May 10, 2024
2 parents f4a8e4f + 807fa0d commit ba96437
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/auth/auth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}
}

0 comments on commit ba96437

Please sign in to comment.