Authored by 梁志锋

Merge remote-tracking branch 'remotes/origin/feature/passport' into release/4.8

... ... @@ -104,6 +104,7 @@ const local = {
res.clearCookie('LE' + md5('_LOGIN_EXPIRE'), {
domain: 'yohobuy.com'
});
// 设置登录有效时间30分钟, 防机器刷,cache不稳定,改为cookie
res.cookie('LE' + md5('_LOGIN_EXPIRE'), (new Date()).getTime() / 1000 + 1800);
... ...
... ... @@ -17,79 +17,83 @@ const bind = require(cRoot + '/bind');
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('/login', login.common.beforeLogin, login.local.loginPage);
router.post('/login/auth', login.local.login);
router.get('/logout', login.local.logout);
router.get('/passport/login', login.common.beforeLogin, login.local.loginPage);
router.post('/passport/login/auth', login.local.login);
router.get('/passport/logout', login.local.logout);
// 微信登录
router.get('/autosign/wechat', login.common.beforeLogin, login.wechat.login); // 微信登录, 兼容 PHP 的路径
router.get('/login/wechat/callback', login.wechat.callback);
router.get('/passport/autosign/wechat', login.common.beforeLogin, login.wechat.login); // 微信登录, 兼容 PHP 的路径
router.get('/passport/login/wechat/callback', login.wechat.callback);
// sina登录
router.get('/autosign/sina', login.common.beforeLogin, login.sina.login);
router.get('/login/sina/callback', login.sina.callback);
router.get('/passport/autosign/sina', login.common.beforeLogin, login.sina.login);
router.get('/passport/login/sina/callback', login.sina.callback);
// qq登录
router.get('/autosign/qq', login.common.beforeLogin, login.qq.login);
router.get('/login/qq/callback', login.qq.callback);
router.get('/passport/autosign/qq', login.common.beforeLogin, login.qq.login);
router.get('/passport/login/qq/callback', login.qq.callback);
// alipay登录
router.get('/autosign/alipay', login.common.beforeLogin, login.alipay.login);
router.get('/login/alipay/callback', login.alipay.callback);
router.get('/passport/autosign/alipay', login.common.beforeLogin, login.alipay.login);
router.get('/passport/login/alipay/callback', login.alipay.callback);
// douban登录
router.get('/autosign/douban', login.common.beforeLogin, login.douban.login);
router.get('/autosign/doubanback', login.douban.callback);
router.get('/passport/autosign/douban', login.common.beforeLogin, login.douban.login);
router.get('/passport/autosign/doubanback', login.douban.callback);
// renren登录
router.get('/autosign/renren', login.common.beforeLogin, login.renren.login);
router.get('/login/renren/callback', login.renren.callback);
router.get('/passport/autosign/renren', login.common.beforeLogin, login.renren.login);
router.get('/passport/login/renren/callback', login.renren.callback);
router.get('/login/account', login.common.needCaptcha);
router.get('/passport/login/account', login.common.needCaptcha);
// 第三方登录后绑定
router.get('/thirdlogin/index', bind.indexPage);
router.get('/thirdlogin/bindsuccess', bind.bindSuccess);
router.post('/thirdlogin/noregist', bind.noregist);
router.get('/passport/thirdlogin/index', bind.indexPage);
router.get('/passport/thirdlogin/bindsuccess', bind.bindSuccess);
router.post('/passport/thirdlogin/noregist', bind.noregist);
router.post('/autouserinfo/bindCheck', bind.bindCheck);
router.post('/autouserinfo/sendBindMsg', bind.sendBindMsg);
router.post('/autouserinfo/checkBindMsg', bind.checkBindMsg);
router.post('/autouserinfo/bindMobile', bind.bindMobile);
router.post('/passport/autouserinfo/bindCheck', bind.bindCheck);
router.post('/passport/autouserinfo/sendBindMsg', bind.sendBindMsg);
router.post('/passport/autouserinfo/checkBindMsg', bind.checkBindMsg);
router.post('/passport/autouserinfo/bindMobile', bind.bindMobile);
/**
* 注册页面路由
*/
router.get('/reg/index', reg.index);
router.post('/reg/checkmobile', reg.checkMobileMiddleware, reg.checkMobile);
router.post('/reg/piccaptcha', reg.checkCode, reg.picCaptcha);
router.post('/reg/msgcaptcha', reg.checkMobileMiddleware, reg.msgCaptcha);
router.post('/reg/sendBindMsg', reg.checkMobileMiddleware, reg.checkCode, reg.sendBindMsg);
router.post('/reg/mobileregister', reg.checkMobileMiddleware, reg.checkPassword, reg.checkCode, reg.mobileRegister);
router.get('/reg/success', reg.success);
router.get('/passport/reg/index', reg.index);
router.post('/passport/reg/checkmobile', reg.checkMobileMiddleware, reg.checkMobile);
router.post('/passport/reg/piccaptcha', reg.checkCode, reg.picCaptcha);
router.post('/passport/reg/msgcaptcha', reg.checkMobileMiddleware, reg.msgCaptcha);
router.post('/passport/reg/sendBindMsg', reg.checkMobileMiddleware, reg.checkCode, reg.sendBindMsg);
router.post('/passport/reg/mobileregister', reg.checkMobileMiddleware, reg.checkPassword, reg.checkCode, reg.mobileRegister); //eslint-disable-line
router.get('/passport/reg/success', reg.success);
/**
* 找回密码首页信息
*/
// 找回密码首页
router.get('/back/index', back.index);
router.get('/passport/back/index', back.index);
// 实时验证输入是否正确
router.post('/back/authcode',
router.post('/passport/back/authcode',
captcha.requiredAPI,
back.validateInputAPI,
back.getUserInfoAPI);
// 提交按钮邮件API
router.post('/back/email',
router.post('/passport/back/email',
captcha.requiredPage,
back.validateInputPage,
back.sendCodePage,
back.saveInSession);
// 提交按钮手机API
router.post('/back/mobile',
router.post('/passport/back/mobile',
captcha.requiredPage,
back.validateInputPage,
back.sendCodePage,
... ... @@ -99,7 +103,7 @@ router.post('/back/mobile',
* 邮件找回密码
*/
// 发送邮件成功页面
router.get('/back/sendEmail',
router.get('/passport/back/sendEmail',
back.validateEmailInSession,
back.sendEmailPage);
... ... @@ -107,18 +111,18 @@ router.get('/back/sendEmail',
* 短信找回密码
*/
// 验证手机短信页面
router.get('/back/verification',
router.get('/passport/back/verification',
back.validateMobileInSession,
back.verifyCodeByMobilePage);
// 重新发送短信接口
router.post('/back/sendBackMobile',
router.post('/passport/back/sendBackMobile',
captcha.requiredAPI,
back.validateMobileAPI,
back.sendBackMobileAPI);
// 验证手机验证码接口
router.post('/back/backMobile',
router.post('/passport/back/backMobile',
captcha.requiredAPI,
back.verifyCodeByMobileAPI);
... ... @@ -127,24 +131,24 @@ router.post('/back/backMobile',
*/
// 重置密码页面
router.get('/back/backcode',
router.get('/passport/back/backcode',
back.validateExistCodePage,
back.validateCodeByMobilePage,
back.validateCodeByEmailPage,
back.resetPasswordPage);
// 重置密码接口
router.post('/back/update',
router.post('/passport/back/update',
back.validateExistCodePage,
back.validateCodeByMobilePage,
back.validatePwdPage,
back.updatePwdAPI);
// 重置密码成功页面
router.get('/back/resetSuccess',
router.get('/passport/back/resetSuccess',
back.validateSuccessStatusPage,
back.resetPwdSuccessPage);
router.get('/images', captcha.generate);
router.get('/passport/images', captcha.generate);
module.exports = router;
... ...
... ... @@ -11,6 +11,6 @@ module.exports = app => {
// 业务模块
app.use(require('./apps/channel')); // 频道页
app.use(require('./apps/activity')); // 专题活动等活动页面
app.use(require('./apps/passport')); // 登录注册
app.use('/product', require('./apps/product')); // 商品相关页面
app.use('/passport', require('./apps/passport')); // 登录注册
};
... ...