check if req.user exists

Signed-off-by: Philip Molares <philip.molares@udo.edu>
Signed-off-by: David Mehren <dmehren1@gmail.com>
This commit is contained in:
Philip Molares 2020-04-13 11:56:25 +02:00 committed by David Mehren
parent 395d9c671b
commit 8ce724175b
No known key found for this signature in database
GPG key ID: 6017AF117F9756CB

View file

@ -58,7 +58,9 @@ if (config.isOpenIDEnable) AuthRouter.use(openid)
// logout // logout
AuthRouter.get('/logout', function (req: Request, res: Response) { AuthRouter.get('/logout', function (req: Request, res: Response) {
if (config.debug && req.isAuthenticated()) { 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() req.logout()
res.redirect(config.serverURL + '/') res.redirect(config.serverURL + '/')