Skip to content

Commit

Permalink
fix: logout api should add callback
Browse files Browse the repository at this point in the history
Signed-off-by: Yukai Huang <[email protected]>
  • Loading branch information
Yukaii committed Dec 26, 2023
1 parent 070808b commit c436af1
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lib/auth/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,14 @@ if (config.isEmailEnable) authRouter.use(require('./email'))
if (config.isOpenIDEnable) authRouter.use(require('./openid'))

// logout
authRouter.get('/logout', function (req, res) {
authRouter.get('/logout', function (req, res, next) {
if (config.debug && req.isAuthenticated()) {
logger.debug('user logout: ' + req.user.id)
}
req.logout()
res.redirect(config.serverURL + '/')

req.logout((err) => {
if (err) { return next(err) }

res.redirect(config.serverURL + '/')
})
})

0 comments on commit c436af1

Please sign in to comment.