fix trying to get user if there was no jwt subject

This commit is contained in:
Pouria Ezzati 2025-01-04 13:25:09 +03:30
parent 54b7e62e94
commit 2e08b35803

View File

@ -17,7 +17,7 @@ passport.use(
try {
// 'sub' used to be the email address
// this check makes sure to invalidate old JWTs where the sub is still the email address
if (typeof payload.sub === "string") {
if (typeof payload.sub === "string" || !payload.sub) {
return done(null, false);
}
const user = await query.user.find({ id: payload.sub });