Skip to content
This repository has been archived by the owner on Apr 19, 2023. It is now read-only.

Commit

Permalink
♻️ Auto-set account to active on login
Browse files Browse the repository at this point in the history
  • Loading branch information
AnandChowdhary committed Nov 9, 2020
1 parent 86148ea commit dc1a370
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/modules/auth/auth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,11 @@ export class AuthService {
},
});
if (!user) throw new NotFoundException(USER_NOT_FOUND);
if (!user.active)
await this.prisma.users.update({
where: { id: user.id },
data: { active: true },
});
if (!user.emails.find((i) => i.emailSafe === emailSafe)?.isVerified)
throw new UnauthorizedException(UNVERIFIED_EMAIL);
if (!password || !user.password) return this.mfaResponse(user, 'EMAIL');
Expand Down

0 comments on commit dc1a370

Please sign in to comment.