Authored by 毕凯

Merge branch 'hotfix/commentscache' into 'release/6.6'

clean-old-code



See merge request !1380
... ... @@ -11,7 +11,6 @@ const passport = require('passport');
const uuid = require('uuid');
const url = require('url');
const moment = require('moment');
const co = Promise.coroutine;
const cookie = global.yoho.cookie;
const helpers = global.yoho.helpers;
const log = global.yoho.logger;
... ... @@ -547,46 +546,6 @@ exports.user = function(req, res, next) {
res.jsonp(result);
};
/**
* 中间件
* 根据用户登录是否成功决定是否展示验证码
*/
exports.loginShowCaptchaByIp = function(req, res, next) {
// 总开关状态
req.yoho.captchaShow = !_.get(req.app.locals.wap, 'close.loginValidation', false);
// 开关打开,不走任何验证逻辑
if (!req.yoho.captchaShow) {
return next();
} else {
req.yoho.captchaShow = false;
}
// 第一次登录要不要展示验证码:后台开关勾选,首次登录不需要展示
let firstLoginShowCaptcha = !_.get(req.app.locals.wap, 'close.firstLoginShowCaptcha', false);
log.info(`firstLoginShowCaptcha status is ${firstLoginShowCaptcha}`);
if (firstLoginShowCaptcha) {
req.yoho.captchaShow = true;
return next();
} else {
co(function* () {
let hasErrorLog = yield cache.get(`loginErrorIp:${req.yoho.clientIp}`);
log.info(`Pagerender clientip ${req.yoho.clientIp} status is ` + hasErrorLog);
if (hasErrorLog) {
req.yoho.captchaShow = true;
}
next();
})().catch(function(e) {
req.yoho.captchaShow = true;
next();
});
}
};
exports.common = common;
exports.local = local;
exports.wechat = wechat;
... ...
... ... @@ -184,7 +184,6 @@ router.get('/login.html',
login.common.clearCookie,
validateCode.load,
login.common.beforeLogin,
login.loginShowCaptchaByIp,
loginNew.international); // 国际账号登录
router.get('/passport/back/mobile', validateCode.load, back.backByMobile); // 通过手机找回密码
... ...
... ... @@ -45,7 +45,8 @@ function unregister() {
}
window.addEventListener('load', function() {
if (!yoho.isApp) {
// Android WebView 中 UserAgent 不正确
if (!yoho.isApp && !(yoho.isAndroid && yoho.isWechat)) {
if ('serviceWorker' in navigator && isHttps) {
$.ajax({
url: '//m.yohobuy.com/api/switch',
... ...