Skip to content

Commit

Permalink
Fix express middleware receiving a non-error
Browse files Browse the repository at this point in the history
Handle the error with the same pattern as elsewhere in the file.
  • Loading branch information
rakyi committed Nov 7, 2024
1 parent 93b2635 commit e93f6d8
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion adminSiteServer/authentication.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,12 @@ export async function authCloudflareSSOMiddleware(
.table("users")
.where({ email: payload.email })
.first()
if (!user) return next("User not found. Please contact an administrator.")
if (!user) {
console.error(
`User with email ${payload.email} not found. Please contact an administrator.`
)
return next()
}

// Authenticate as the user stored in the token
const { id: sessionId } = await logInAsUser(user)
Expand Down

0 comments on commit e93f6d8

Please sign in to comment.