Просмотр исходного кода

Merge pull request #22970 from overleaf/em-log-user-id

Add userId to request logs when user is logged in

GitOrigin-RevId: c7c907375af20c83f2ac762aa634b8d8cd1d9404
Eric Mc Sween 1 год назад
Родитель
Сommit
71c2dc7d2d
1 измененных файлов с 1 добавлено и 0 удалено
  1. 1 0
      services/web/app/src/Features/Authentication/AuthenticationController.js

+ 1 - 0
services/web/app/src/Features/Authentication/AuthenticationController.js

@@ -357,6 +357,7 @@ const AuthenticationController = {
         return AuthenticationController._redirectToLoginOrRegisterPage(req, res)
         return AuthenticationController._redirectToLoginOrRegisterPage(req, res)
       } else {
       } else {
         req.user = SessionManager.getSessionUser(req.session)
         req.user = SessionManager.getSessionUser(req.session)
+        req.logger?.addFields({ userId: req.user._id })
         return next()
         return next()
       }
       }
     }
     }