We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 12db7da commit 1cb5a16Copy full SHA for 1cb5a16
1 file changed
apps/sim/lib/auth/auth.ts
@@ -844,6 +844,22 @@ export const auth = betterAuth({
844
}
845
846
847
+ if (ctx.path === '/sign-up/email' && ctx.body?.email) {
848
+ const signupEmail = ctx.body.email.toLowerCase()
849
+ const [existingUser] = await db
850
+ .select({ id: schema.user.id })
851
+ .from(schema.user)
852
+ .where(eq(schema.user.email, signupEmail))
853
+ .limit(1)
854
+
855
+ if (existingUser) {
856
+ throw new APIError('UNPROCESSABLE_ENTITY', {
857
+ message: 'User already exists',
858
+ code: 'USER_ALREADY_EXISTS',
859
+ })
860
+ }
861
862
863
return
864
}),
865
},
0 commit comments