From 8ce724175bcf3da3e4076b6dcf2b909f580dcc19 Mon Sep 17 00:00:00 2001 From: Philip Molares Date: Mon, 13 Apr 2020 11:56:25 +0200 Subject: [PATCH] check if req.user exists Signed-off-by: Philip Molares Signed-off-by: David Mehren --- lib/web/auth/index.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/web/auth/index.ts b/lib/web/auth/index.ts index edda63775..782f5a207 100644 --- a/lib/web/auth/index.ts +++ b/lib/web/auth/index.ts @@ -58,7 +58,9 @@ if (config.isOpenIDEnable) AuthRouter.use(openid) // logout AuthRouter.get('/logout', function (req: Request, res: Response) { if (config.debug && req.isAuthenticated()) { - logger.debug('user logout: ' + req.user?.id) + if (req.user !== undefined) { + logger.debug('user logout: ' + req.user.id) + } } req.logout() res.redirect(config.serverURL + '/')