Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

don't register SSO users if an email linked to their account already exists in Swetrix DB

Blue Moused850c4fc5472
diff --git a/src/auth/auth.service.ts b/src/auth/auth.service.ts
index 0a4919db0..3f8c81171 100644
--- a/src/auth/auth.service.ts
+++ b/src/auth/auth.service.ts
@@ -499,14 +499,18 @@ export class AuthService {
registeredWithGoogle: true,
isActive: true,
emailRequests: 0,
+ email,
}
const userWithSameEmail = await this.userService.findOneWhere({
email,
})
- if (!userWithSameEmail) {
- query.email = email
+ if (userWithSameEmail) {
+ console.error(`[ERROR][AuthService -> registerUserGoogle] User with email ${email} already exists`)
+ throw new BadRequestException(
+ 'There is already an account associated with this email address',
+ )
}
const user = await this.userService.create(query)
@@ -844,14 +848,18 @@ export class AuthService {
registeredWithGithub: true,
isActive: true,
emailRequests: 0,
+ email,
}
const userWithSameEmail = await this.userService.findOneWhere({
email,
})
- if (!userWithSameEmail) {
- query.email = email
+ if (userWithSameEmail) {
+ console.error(`[ERROR][AuthService -> registerUserGithub] User with email ${email} already exists`)
+ throw new BadRequestException(
+ 'There is already an account associated with this email address',
+ )
}
const user = await this.userService.create(query)