Showing
1 changed file
with
3 additions
and
3 deletions
@@ -11,18 +11,18 @@ const {CAPTCHA_SWITCH, CAPTCHA_TYPE} = require('../models/captcha-type'); | @@ -11,18 +11,18 @@ const {CAPTCHA_SWITCH, CAPTCHA_TYPE} = require('../models/captcha-type'); | ||
11 | 11 | ||
12 | 12 | ||
13 | const isGeetest = (req) => { | 13 | const isGeetest = (req) => { |
14 | - return _.get(req.app.locals.pc, 'geetest.validation', false); | 14 | + return _.get(req.session, 'captcha.type', '') === CAPTCHA_TYPE.geetest; |
15 | }; | 15 | }; |
16 | 16 | ||
17 | function required(req, res, next) { | 17 | function required(req, res, next) { |
18 | img.trySwitch(req).then(() => { | 18 | img.trySwitch(req).then(() => { |
19 | - if (isGeetest(req)) { | 19 | + if (req.session.captcha.type === CAPTCHA_TYPE.image && req.session.captcha.value === CAPTCHA_SWITCH.off) { |
20 | const captcha = { | 20 | const captcha = { |
21 | type: CAPTCHA_TYPE.geetest, | 21 | type: CAPTCHA_TYPE.geetest, |
22 | value: CAPTCHA_SWITCH.on | 22 | value: CAPTCHA_SWITCH.on |
23 | }; | 23 | }; |
24 | 24 | ||
25 | - req.session.capthca = captcha; | 25 | + req.session.captcha = captcha; |
26 | req.app.locals.captcha = captcha; | 26 | req.app.locals.captcha = captcha; |
27 | } | 27 | } |
28 | next(); | 28 | next(); |
-
Please register or login to post a comment