mirror of
https://github.com/lukevella/rallly.git
synced 2025-07-29 06:07:25 +02:00
🔨 Use email as distinct id
This commit is contained in:
parent
1e4fe071aa
commit
63c6c4f92d
1 changed files with 3 additions and 2 deletions
|
@ -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 verified
|
||||
if (
|
||||
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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue