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: {
|
callbacks: {
|
||||||
async signIn({ user, email, account, profile }) {
|
async signIn({ user, email, account, profile }) {
|
||||||
const posthog = PostHogClient();
|
const posthog = PostHogClient();
|
||||||
|
const distinctId = user.email ?? user.id;
|
||||||
// prevent sign in if email is not verified
|
// prevent sign in if email is not verified
|
||||||
if (
|
if (
|
||||||
profile &&
|
profile &&
|
||||||
|
@ -169,7 +170,7 @@ const getAuthOptions = (...args: GetServerSessionParams) =>
|
||||||
profile.email_verified === false
|
profile.email_verified === false
|
||||||
) {
|
) {
|
||||||
posthog?.capture({
|
posthog?.capture({
|
||||||
distinctId: user.id,
|
distinctId,
|
||||||
event: "login failed",
|
event: "login failed",
|
||||||
properties: {
|
properties: {
|
||||||
reason: "email not verified",
|
reason: "email not verified",
|
||||||
|
@ -209,7 +210,7 @@ const getAuthOptions = (...args: GetServerSessionParams) =>
|
||||||
}
|
}
|
||||||
|
|
||||||
posthog?.capture({
|
posthog?.capture({
|
||||||
distinctId: user.id,
|
distinctId,
|
||||||
event: "login",
|
event: "login",
|
||||||
properties: {
|
properties: {
|
||||||
method: account?.provider,
|
method: account?.provider,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue