Fix jwt-token
This commit is contained in:
@@ -64,10 +64,17 @@ async function authenticateToken(req, res, next) {
|
||||
}]
|
||||
});
|
||||
|
||||
if (!user || !user.is_active) {
|
||||
if (!user) {
|
||||
return res.status(401).json({
|
||||
success: false,
|
||||
message: 'Invalid or inactive user'
|
||||
message: 'User not found'
|
||||
});
|
||||
}
|
||||
|
||||
if (!user.is_active) {
|
||||
return res.status(401).json({
|
||||
success: false,
|
||||
message: 'User account is inactive'
|
||||
});
|
||||
}
|
||||
|
||||
@@ -80,7 +87,8 @@ async function authenticateToken(req, res, next) {
|
||||
role: user.role,
|
||||
is_active: user.is_active,
|
||||
tenant_id: user.tenant_id,
|
||||
tenant: user.tenant
|
||||
tenant: user.tenant,
|
||||
tenantId: tenantId || (user.tenant ? user.tenant.slug : undefined) // Include tenantId in user object
|
||||
};
|
||||
|
||||
// Set tenant context - prefer JWT tenantId, fallback to user's tenant
|
||||
|
||||
Reference in New Issue
Block a user