...
|
...
|
@@ -8,7 +8,7 @@ const captchaService = require('../models/captcha-img-service'); |
|
|
const CAPTCHA = global.yoho.config.UNIVERSAL_CAPTCHA;
|
|
|
const request = require('request');
|
|
|
const logger = global.yoho.logger;
|
|
|
const CAPTCHATIME = 1 * 60; //默认1分钟
|
|
|
const CAPTCHATIME = 1 * 60000; //默认1分钟
|
|
|
|
|
|
// 对比函数
|
|
|
const _mustEqual = (req) => {
|
...
|
...
|
@@ -27,7 +27,7 @@ const requiredAPI = (req, res, next) => { |
|
|
let time = new Date().getTime();
|
|
|
let firstTime = req.session.captchaTime;
|
|
|
|
|
|
if (count >= 4 || firstTime && (time - firstTime > CAPTCHATIME * 1000)) {
|
|
|
if (count >= 4 || firstTime && (time - firstTime > CAPTCHATIME)) {
|
|
|
req.session.captcha = CAPTCHA;
|
|
|
|
|
|
return res.json({
|
...
|
...
|
@@ -74,7 +74,7 @@ const checkAPI = (req, res) => { |
|
|
let time = new Date().getTime();
|
|
|
let firstTime = req.session.captchaTime;
|
|
|
|
|
|
if (count >= 4 || firstTime && (time - firstTime > CAPTCHATIME * 1000)) {
|
|
|
if (count >= 4 || firstTime && (time - firstTime > CAPTCHATIME)) {
|
|
|
req.session.captcha = CAPTCHA;
|
|
|
|
|
|
return res.json({
|
...
|
...
|
|