merge master
Showing
5 changed files
with
13 additions
and
7 deletions
@@ -201,6 +201,6 @@ router.get('/passport/back/resetSuccess', | @@ -201,6 +201,6 @@ router.get('/passport/back/resetSuccess', | ||
201 | 201 | ||
202 | router.get('/passport/imagesNode', captcha.generate); | 202 | router.get('/passport/imagesNode', captcha.generate); |
203 | router.post('/passport/captcha/img', captcha.checkAPI); | 203 | router.post('/passport/captcha/img', captcha.checkAPI); |
204 | -router.get('/passport/images', captcha.generateQiniu); | 204 | +router.get('/passport/images.png', captcha.generateQiniu); |
205 | 205 | ||
206 | module.exports = router; | 206 | module.exports = router; |
@@ -10,9 +10,9 @@ const captchaPolicy = require('./policies/captcha'); | @@ -10,9 +10,9 @@ const captchaPolicy = require('./policies/captcha'); | ||
10 | const reporterPolicy = require('./policies/reporter'); | 10 | const reporterPolicy = require('./policies/reporter'); |
11 | 11 | ||
12 | const IP_WHITE_LIST = [ | 12 | const IP_WHITE_LIST = [ |
13 | - | ||
14 | - // '106.38.38.146', | ||
15 | - // '218.94.75.58' | 13 | + '106.38.38.146', |
14 | + '218.94.75.58', | ||
15 | + '218.94.75.50' | ||
16 | ]; | 16 | ]; |
17 | 17 | ||
18 | const limiter = (rule, policy, context) => { | 18 | const limiter = (rule, policy, context) => { |
@@ -20,7 +20,7 @@ const limiter = (rule, policy, context) => { | @@ -20,7 +20,7 @@ const limiter = (rule, policy, context) => { | ||
20 | }; | 20 | }; |
21 | 21 | ||
22 | module.exports = (req, res, next) => { | 22 | module.exports = (req, res, next) => { |
23 | - let remoteIp = req.get('X-Forwarded-For') || req.connection.remoteAddress; | 23 | + let remoteIp = req.get('X-Forwarded-For') || req.get('X-Real-IP') || ''; |
24 | 24 | ||
25 | if (remoteIp.indexOf(',') > 0) { | 25 | if (remoteIp.indexOf(',') > 0) { |
26 | let arr = remoteIp.split(','); | 26 | let arr = remoteIp.split(','); |
@@ -30,6 +30,10 @@ module.exports = (req, res, next) => { | @@ -30,6 +30,10 @@ module.exports = (req, res, next) => { | ||
30 | 30 | ||
31 | remoteIp = _.trim(remoteIp); | 31 | remoteIp = _.trim(remoteIp); |
32 | 32 | ||
33 | + if (_.startsWith(remoteIp, '10.66.')) { | ||
34 | + remoteIp = req.get('X-Real-IP'); | ||
35 | + } | ||
36 | + | ||
33 | logger.info('request remote ip: ', remoteIp); | 37 | logger.info('request remote ip: ', remoteIp); |
34 | 38 | ||
35 | const excluded = _.includes(IP_WHITE_LIST, remoteIp); | 39 | const excluded = _.includes(IP_WHITE_LIST, remoteIp); |
@@ -6,6 +6,7 @@ const _ = require('lodash'); | @@ -6,6 +6,7 @@ const _ = require('lodash'); | ||
6 | const WHITE_LIST = [ | 6 | const WHITE_LIST = [ |
7 | '/3party/check', | 7 | '/3party/check', |
8 | '/passport/imagesNode', | 8 | '/passport/imagesNode', |
9 | + '/passport/images.png', | ||
9 | '/passport/cert/headerTip' | 10 | '/passport/cert/headerTip' |
10 | ]; | 11 | ]; |
11 | 12 |
1 | { | 1 | { |
2 | "name": "yohobuy-node", | 2 | "name": "yohobuy-node", |
3 | - "version": "5.4.23", | 3 | + "version": "5.4.25", |
4 | "private": true, | 4 | "private": true, |
5 | "description": "A New Yohobuy Project With Express", | 5 | "description": "A New Yohobuy Project With Express", |
6 | "repository": { | 6 | "repository": { |
@@ -56,6 +56,7 @@ | @@ -56,6 +56,7 @@ | ||
56 | "passport-sina": "^0.1.0", | 56 | "passport-sina": "^0.1.0", |
57 | "passport-strategy": "1.x.x", | 57 | "passport-strategy": "1.x.x", |
58 | "passport-weixin": "^0.1.0", | 58 | "passport-weixin": "^0.1.0", |
59 | + "request": "^2.81.0", | ||
59 | "request-ip": "^1.2.2", | 60 | "request-ip": "^1.2.2", |
60 | "request-promise": "^3.0.0", | 61 | "request-promise": "^3.0.0", |
61 | "serve-favicon": "^2.3.0", | 62 | "serve-favicon": "^2.3.0", |
@@ -5,7 +5,7 @@ | @@ -5,7 +5,7 @@ | ||
5 | var Captcha = function(container, options) { | 5 | var Captcha = function(container, options) { |
6 | var optionDefault = { | 6 | var optionDefault = { |
7 | template: require('hbs/common/captcha.hbs'), | 7 | template: require('hbs/common/captcha.hbs'), |
8 | - refreshURI: '/passport/images', | 8 | + refreshURI: '/passport/images.png', |
9 | checkURI: '/passport/captcha/img' | 9 | checkURI: '/passport/captcha/img' |
10 | }; | 10 | }; |
11 | 11 |
-
Please register or login to post a comment