Fix jwt-token

This commit is contained in:
2025-09-14 09:48:51 +02:00
parent cfa1af0fd0
commit 674c2e2d8f
3 changed files with 30 additions and 15 deletions

View File

@@ -151,8 +151,20 @@ router.post('/login', validateRequest(loginSchema), async (req, res) => {
// GET /api/users/profile - Get current user profile
router.get('/profile', authenticateToken, async (req, res) => {
try {
// Log the user object for debugging
console.log('📍 /users/profile - req.user:', {
id: req.user.id,
username: req.user.username,
role: req.user.role,
email: req.user.email,
is_active: req.user.is_active,
tenant_id: req.user.tenant_id
});
const { password_hash: _, ...userProfile } = req.user.toJSON();
console.log('📤 /users/profile - Response:', userProfile);
res.json({
success: true,
data: userProfile