Showing
1 changed file
with
3 additions
and
3 deletions
@@ -292,7 +292,7 @@ const wechat = { | @@ -292,7 +292,7 @@ const wechat = { | ||
292 | callback: (req, res, next) => { | 292 | callback: (req, res, next) => { |
293 | if (req.session && req.session.authState && req.session.authState === req.query.state) { | 293 | if (req.session && req.session.authState && req.session.authState === req.query.state) { |
294 | passport.authenticate('weixin', (err, user) => { | 294 | passport.authenticate('weixin', (err, user) => { |
295 | - if (err) { | 295 | + if (err || !user) { |
296 | log.error(`wechat authenticate error : ${JSON.stringify(err)}`); | 296 | log.error(`wechat authenticate error : ${JSON.stringify(err)}`); |
297 | return res.redirect(loginPage); | 297 | return res.redirect(loginPage); |
298 | } | 298 | } |
@@ -320,7 +320,7 @@ const sina = { | @@ -320,7 +320,7 @@ const sina = { | ||
320 | callback: (req, res, next) => { | 320 | callback: (req, res, next) => { |
321 | if (req.session && req.session.authState && req.session.authState === req.query.state) { | 321 | if (req.session && req.session.authState && req.session.authState === req.query.state) { |
322 | passport.authenticate('sina', (err, user) => { | 322 | passport.authenticate('sina', (err, user) => { |
323 | - if (err) { | 323 | + if (err || !user) { |
324 | log.error(`sina authenticate error : ${JSON.stringify(err)}`); | 324 | log.error(`sina authenticate error : ${JSON.stringify(err)}`); |
325 | return res.redirect(loginPage); | 325 | return res.redirect(loginPage); |
326 | } | 326 | } |
@@ -373,7 +373,7 @@ const alipay = { | @@ -373,7 +373,7 @@ const alipay = { | ||
373 | }, | 373 | }, |
374 | callback: (req, res, next) => { | 374 | callback: (req, res, next) => { |
375 | passport.authenticate('alipay', (err, user) => { | 375 | passport.authenticate('alipay', (err, user) => { |
376 | - if (err) { | 376 | + if (err || !user) { |
377 | log.error(`alipay authenticate error : ${JSON.stringify(err)}`); | 377 | log.error(`alipay authenticate error : ${JSON.stringify(err)}`); |
378 | return res.redirect(loginPage); | 378 | return res.redirect(loginPage); |
379 | } | 379 | } |
-
Please register or login to post a comment