From c436af1d62fa053658facd02007571809a809a77 Mon Sep 17 00:00:00 2001 From: Yukai Huang Date: Tue, 26 Dec 2023 17:54:12 +0800 Subject: [PATCH] fix: logout api should add callback Signed-off-by: Yukai Huang --- lib/auth/index.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/auth/index.js b/lib/auth/index.js index fcc39a2a49..02e750d075 100644 --- a/lib/auth/index.js +++ b/lib/auth/index.js @@ -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 + '/') + }) })