...
|
...
|
@@ -7,7 +7,6 @@ |
|
|
// const _ = require('lodash');
|
|
|
|
|
|
const captchaService = require('../models/captcha-img-service');
|
|
|
const helpers = global.yoho.helpers;
|
|
|
const CAPTCHA = global.yoho.config.UNIVERSAL_CAPTCHA;
|
|
|
const request = require('request');
|
|
|
const logger = global.yoho.logger;
|
...
|
...
|
@@ -47,24 +46,6 @@ const requiredAPI = (req, res, next) => { |
|
|
}
|
|
|
};
|
|
|
|
|
|
// 重定向调用
|
|
|
const requiredPage = (req, res, next) => {
|
|
|
let count = req.session.captchaCount;
|
|
|
|
|
|
if (count >= 4) {
|
|
|
req.session.captcha = CAPTCHA;
|
|
|
|
|
|
return res.redirect(helpers.urlFormat('/passport/back/index'));
|
|
|
}
|
|
|
|
|
|
req.session.captchaCount = count + 1;
|
|
|
if (_mustEqual(req)) {
|
|
|
return next();
|
|
|
} else {
|
|
|
return res.redirect(helpers.urlFormat('/passport/back/index'));
|
|
|
}
|
|
|
};
|
|
|
|
|
|
// 七牛验证码
|
|
|
const generate = (req, res, next) => {
|
|
|
captchaService.generateCaptcha().then((result) => {
|
...
|
...
|
@@ -108,7 +89,6 @@ const checkAPI = (req, res) => { |
|
|
|
|
|
module.exports = {
|
|
|
requiredAPI,
|
|
|
requiredPage,
|
|
|
generate,
|
|
|
checkAPI
|
|
|
}; |
...
|
...
|
|