Authored by 陈轩

fix 5712 5714

... ... @@ -37,7 +37,8 @@ let guardStep = function(step) {
if (req.xhr) {
return res.json({
code: 400,
refer: '/reg.html'
refer: '/reg.html',
message: '页面失效'
});
} else {
return res.redirect('/reg.html');
... ...
... ... @@ -13,6 +13,8 @@ const back = require(cRoot + '/back');
const bind = require(cRoot + '/bind');
const reg = require(cRoot + '/reg');
const disableBFCahce = require('../../doraemon/middleware/disable-BFCache');
const smsLogin = require(cRoot + '/sms');
const update = require(cRoot + '/update');
const agreement = require(cRoot + '/app-agreement');
... ... @@ -21,7 +23,7 @@ const router = express.Router(); // eslint-disable-line
// 兼容老的路由
router.get('/signin.html', login.common.beforeLogin, login.local.loginPage);
router.get('/reg.html', reg.index);
router.get('/reg.html', disableBFCahce, reg.index);
router.get('/login.html', login.common.beforeLogin, login.local.international);
router.get('/phoneback.html', back.indexMobilePage);
router.get('/emailback.html', back.indexEmailPage);
... ... @@ -85,6 +87,7 @@ router.post('/passport/bind/changeMobile', bind.changeMobile);
/**
* 注册
*/
router.use('/passport/reg/*', disableBFCahce);
router.get('/passport/reg/index', reg.index);
router.get('/passport/reg/captcha.png', reg.genCaptcha);
router.post('/passport/reg/verifymobile', reg.sendCodeBusyBoy, reg.verifyMobile);
... ...
/**
* disable Back forward cache
*/
module.exports = (req, res, next) => {
res.set({
'Cache-Control': 'no-cache, max-age=0, must-revalidate, no-store',
Pragma: 'no-cache',
Expires: 0
});
next();
};
... ...
... ... @@ -41,6 +41,8 @@ module.exports = () => {
res.removeHeader('Expires');
} else if (req.get('X-Requested-With') === 'XMLHttpRequest') {
res.set('Cache-Control', 'no-cache');
} else if (res.get('Cache-Control')) { // 业务代码里设了cache, 中断下面的判断
// nothing
} else {
res.set({
'Cache-Control': 'no-cache',
... ...
... ... @@ -68,9 +68,11 @@ module.exports = function(useInRegister, useForBind, useForRelate) {
if (data.code === 200) {
location.href = data.data;
} else {
// 验证码不正确,显示提示
showErrTip(data.message);
if (data.refer) {
location.href = data.refer;
}
}
}
... ...