Fix jwt-token

This commit is contained in:
2025-09-16 08:11:51 +02:00
parent 78fa165665
commit 9589e5be33

View File

@@ -387,8 +387,10 @@ async function loginLocal(req, res, next) {
// Get tenant information from request (set by multi-tenant auth middleware)
let tenantId = null;
if (req.tenant && req.tenant.id) {
console.log('🔧 DEBUG: Looking for tenant with slug:', req.tenant.id);
// Find the actual tenant in database
const tenant = await Tenant.findOne({ where: { slug: req.tenant.id } });
console.log('🔧 DEBUG: Found tenant:', tenant ? { id: tenant.id, slug: tenant.slug } : 'null');
if (tenant) {
tenantId = tenant.id;
}