Skip to content

Commit

Permalink
Merge pull request #1837 from hackmdio/bugfix/logout-callback
Browse files Browse the repository at this point in the history
  • Loading branch information
stanley2058 authored Dec 26, 2023
2 parents f58c669 + c436af1 commit 9790586
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 9790586

Please sign in to comment.