Skip to content

Commit c436af1

Browse files
committed
fix: logout api should add callback
Signed-off-by: Yukai Huang <yukaihuangtw@gmail.com>
1 parent 070808b commit c436af1

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

lib/auth/index.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,14 @@ if (config.isEmailEnable) authRouter.use(require('./email'))
4949
if (config.isOpenIDEnable) authRouter.use(require('./openid'))
5050

5151
// logout
52-
authRouter.get('/logout', function (req, res) {
52+
authRouter.get('/logout', function (req, res, next) {
5353
if (config.debug && req.isAuthenticated()) {
5454
logger.debug('user logout: ' + req.user.id)
5555
}
56-
req.logout()
57-
res.redirect(config.serverURL + '/')
56+
57+
req.logout((err) => {
58+
if (err) { return next(err) }
59+
60+
res.redirect(config.serverURL + '/')
61+
})
5862
})

0 commit comments

Comments
 (0)