Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion apps/sim/lib/auth/auth.ts
Original file line numberDiff line numberDiff line change
Expand Up@@ -80,7 +80,7 @@ import { sendEmail } from '@/lib/messaging/email/mailer'
import { getFromEmailAddress, getPersonalEmailFrom } from '@/lib/messaging/email/utils'
import { quickValidateEmail } from '@/lib/messaging/email/validation'
import { scheduleLifecycleEmail } from '@/lib/messaging/lifecycle'
import { captureServerEvent } from '@/lib/posthog/server'
import { captureServerEvent, getPostHogClient } from '@/lib/posthog/server'
import { syncAllWebhooksForCredentialSet } from '@/lib/webhooks/utils.server'
import { disableUserResources } from '@/lib/workflows/lifecycle'
import { SSO_TRUSTED_PROVIDERS } from '@/ee/sso/constants'
Expand DownExpand Up@@ -196,6 +196,21 @@ export const auth = betterAuth({
// Telemetry should not fail the operation
}

try {
const client = getPostHogClient()
if (client) {
client.identify({
distinctId: user.id,
properties: {
...(user.email ? { email: user.email } : {}),
...(user.name ? { name: user.name } : {}),
},
})
}
} catch {
// Telemetry should not fail the operation
}
Comment thread
waleedlatif1 marked this conversation as resolved.

try {
await handleNewUser(user.id)
} catch (error) {
Expand DownExpand Up@@ -396,6 +411,7 @@ export const auth = betterAuth({
: SSO_TRUSTED_PROVIDERS.includes(providerId)
? 'sso'
: 'oauth'

captureServerEvent(
account.userId,
'user_created',
Expand Down
Loading