diff --git a/src/modules/auth/auth.service.ts b/src/modules/auth/auth.service.ts index 47bc318be..cd082b0ea 100644 --- a/src/modules/auth/auth.service.ts +++ b/src/modules/auth/auth.service.ts @@ -155,6 +155,11 @@ export class AuthService { create: { email: email, emailSafe }, }, }, + include: { emails: { select: { id: true } } }, + }); + await this.prisma.users.update({ + where: { id: user.id }, + data: { prefersEmail: { connect: { id: user.emails[0]?.id } } }, }); await this.sendEmailVerification(email); await this.approvedSubnetsService.approveNewSubnet(user.id, ipAddress); diff --git a/src/modules/geolocation/geolocation.service.ts b/src/modules/geolocation/geolocation.service.ts index ce4d627e1..e82188d46 100644 --- a/src/modules/geolocation/geolocation.service.ts +++ b/src/modules/geolocation/geolocation.service.ts @@ -36,7 +36,7 @@ export class GeolocationService implements OnModuleDestroy { } private async getUnsafeLocation(ipAddress: string) { - if (this.lookup) + if (!this.lookup) this.lookup = await geolite2.open('GeoLite2-City', path => { return maxmind.open(path); });