Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.
TypeScript i18nextnext-authnextjspostgresqlprismareact-emailt3-stacktailwindcsstrpcturborepotypescriptzod
🔨 Use email as distinct id
Luke Vella63c6c4f92d78
diff --git a/apps/web/src/utils/auth.ts b/apps/web/src/utils/auth.tsindex add318497..7025f16d0 100644--- a/apps/web/src/utils/auth.ts+++ b/apps/web/src/utils/auth.ts@@ -162,6 +162,7 @@ const getAuthOptions = (...args: GetServerSessionParams) =>callbacks: {async signIn({ user, email, account, profile }) {const posthog = PostHogClient();+ const distinctId = user.email ?? user.id;// prevent sign in if email is not verifiedif (profile &&@@ -169,7 +170,7 @@ const getAuthOptions = (...args: GetServerSessionParams) =>profile.email_verified === false) {posthog?.capture({- distinctId: user.id,+ distinctId,event: "login failed",properties: {reason: "email not verified",@@ -209,7 +210,7 @@ const getAuthOptions = (...args: GetServerSessionParams) =>}posthog?.capture({- distinctId: user.id,+ distinctId,event: "login",properties: {method: account?.provider,