Authored by htoooth

fix

... ... @@ -26,9 +26,9 @@ const cache = global.yoho.cache;
let siteUrl = config.siteUrl.indexOf('//') === 0 ? 'http:' + config.siteUrl : config.siteUrl;
function getLoginStat(account) {
let errorLoginKey = 'account_errorlogin_' + account;
let accountKey = 'account_signin_' + account;
function getLoginStat(ip) {
let errorLoginKey = 'loginErrorIp:' + ip;
let accountKey = 'signinErrorIp:' + ip;
let cacheGet = [cache.get(errorLoginKey), cache.get(accountKey)];
return Promise.all(cacheGet).catch(() => {
... ... @@ -51,15 +51,13 @@ passport.use('local', new LocalStrategy({
}
let shoppingKey = cookie.getShoppingKey(req);
let clientIp = req.yoho.clientIp;
let account = req.body.account;
let type = req.body.loginType;
let errorLoginKey = 'account_errorlogin_' + clientIp;
let accountKey = 'account_signin_' + clientIp;
let clientIp = req.yoho.clientIp;
let errorLoginKey = 'loginErrorIp:' + clientIp;
let accountKey = 'signinErrorIp:' + clientIp;
getLoginStat(account).then(times => {
getLoginStat(clientIp).then(times => {
let errLoginTimes = _.parseInt(times[0]) || 0;
let accountTimes = _.parseInt(times[1]) || 0;
... ...