Fix jwt-token

This commit is contained in:
2025-09-16 08:14:52 +02:00
parent cb9a9e1098
commit bdb0fb079b

View File

@@ -422,7 +422,9 @@ async function loginLocal(req, res, next) {
whereClause[Op.and].push({ tenant_id: null });
}
console.log('🔧 DEBUG: User search whereClause:', JSON.stringify(whereClause, null, 2));
const user = await User.findOne({ where: whereClause });
console.log('🔧 DEBUG: Found user:', user ? { id: user.id, username: user.username, tenant_id: user.tenant_id } : 'null');
if (!user || !await bcrypt.compare(password, user.password_hash)) {
console.log(`❌ Authentication failed for "${username}" in tenant "${req.tenant?.id}"`);