Skip to content

Commit

Permalink
Set user in Sentry
Browse files Browse the repository at this point in the history
  • Loading branch information
rakyi committed Jan 20, 2025
1 parent 1d28275 commit 861a0a0
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions adminSiteServer/authentication.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import * as Sentry from "@sentry/node"
import express from "express"
import crypto from "crypto"
import randomstring from "randomstring"
Expand Down Expand Up @@ -194,6 +195,13 @@ export async function authMiddleware(
if (user?.isActive) {
res.locals.session = session
res.locals.user = user

Sentry.setUser({
id: user.id,
email: user.email,
username: user.fullName,
})

return next()
} else if (!req.path.startsWith("/admin") || req.path === "/admin/login")
return next()
Expand Down

0 comments on commit 861a0a0

Please sign in to comment.