Authored by 王水玲

注册登录添加兼容的老路由

@@ -104,6 +104,7 @@ const local = { @@ -104,6 +104,7 @@ const local = {
104 res.clearCookie('LE' + md5('_LOGIN_EXPIRE'), { 104 res.clearCookie('LE' + md5('_LOGIN_EXPIRE'), {
105 domain: 'yohobuy.com' 105 domain: 'yohobuy.com'
106 }); 106 });
  107 +
107 // 设置登录有效时间30分钟, 防机器刷,cache不稳定,改为cookie 108 // 设置登录有效时间30分钟, 防机器刷,cache不稳定,改为cookie
108 res.cookie('LE' + md5('_LOGIN_EXPIRE'), (new Date()).getTime() / 1000 + 1800); 109 res.cookie('LE' + md5('_LOGIN_EXPIRE'), (new Date()).getTime() / 1000 + 1800);
109 110
@@ -17,79 +17,83 @@ const bind = require(cRoot + '/bind'); @@ -17,79 +17,83 @@ const bind = require(cRoot + '/bind');
17 17
18 const router = express.Router(); // eslint-disable-line 18 const router = express.Router(); // eslint-disable-line
19 19
  20 +// 兼容老的路由
  21 +router.get('/signin.html', login.common.beforeLogin, login.local.loginPage);
  22 +router.get('/reg.html', reg.index);
  23 +
20 // 本地登录 24 // 本地登录
21 -router.get('/login', login.common.beforeLogin, login.local.loginPage);  
22 -router.post('/login/auth', login.local.login);  
23 -router.get('/logout', login.local.logout); 25 +router.get('/passport/login', login.common.beforeLogin, login.local.loginPage);
  26 +router.post('/passport/login/auth', login.local.login);
  27 +router.get('/passport/logout', login.local.logout);
24 28
25 // 微信登录 29 // 微信登录
26 -router.get('/autosign/wechat', login.common.beforeLogin, login.wechat.login); // 微信登录, 兼容 PHP 的路径  
27 -router.get('/login/wechat/callback', login.wechat.callback); 30 +router.get('/passport/autosign/wechat', login.common.beforeLogin, login.wechat.login); // 微信登录, 兼容 PHP 的路径
  31 +router.get('/passport/login/wechat/callback', login.wechat.callback);
28 32
29 // sina登录 33 // sina登录
30 -router.get('/autosign/sina', login.common.beforeLogin, login.sina.login);  
31 -router.get('/login/sina/callback', login.sina.callback); 34 +router.get('/passport/autosign/sina', login.common.beforeLogin, login.sina.login);
  35 +router.get('/passport/login/sina/callback', login.sina.callback);
32 36
33 // qq登录 37 // qq登录
34 -router.get('/autosign/qq', login.common.beforeLogin, login.qq.login);  
35 -router.get('/login/qq/callback', login.qq.callback); 38 +router.get('/passport/autosign/qq', login.common.beforeLogin, login.qq.login);
  39 +router.get('/passport/login/qq/callback', login.qq.callback);
36 40
37 // alipay登录 41 // alipay登录
38 -router.get('/autosign/alipay', login.common.beforeLogin, login.alipay.login);  
39 -router.get('/login/alipay/callback', login.alipay.callback); 42 +router.get('/passport/autosign/alipay', login.common.beforeLogin, login.alipay.login);
  43 +router.get('/passport/login/alipay/callback', login.alipay.callback);
40 44
41 // douban登录 45 // douban登录
42 -router.get('/autosign/douban', login.common.beforeLogin, login.douban.login);  
43 -router.get('/autosign/doubanback', login.douban.callback); 46 +router.get('/passport/autosign/douban', login.common.beforeLogin, login.douban.login);
  47 +router.get('/passport/autosign/doubanback', login.douban.callback);
44 48
45 // renren登录 49 // renren登录
46 -router.get('/autosign/renren', login.common.beforeLogin, login.renren.login);  
47 -router.get('/login/renren/callback', login.renren.callback); 50 +router.get('/passport/autosign/renren', login.common.beforeLogin, login.renren.login);
  51 +router.get('/passport/login/renren/callback', login.renren.callback);
48 52
49 -router.get('/login/account', login.common.needCaptcha); 53 +router.get('/passport/login/account', login.common.needCaptcha);
50 54
51 // 第三方登录后绑定 55 // 第三方登录后绑定
52 -router.get('/thirdlogin/index', bind.indexPage);  
53 -router.get('/thirdlogin/bindsuccess', bind.bindSuccess);  
54 -router.post('/thirdlogin/noregist', bind.noregist); 56 +router.get('/passport/thirdlogin/index', bind.indexPage);
  57 +router.get('/passport/thirdlogin/bindsuccess', bind.bindSuccess);
  58 +router.post('/passport/thirdlogin/noregist', bind.noregist);
55 59
56 -router.post('/autouserinfo/bindCheck', bind.bindCheck);  
57 -router.post('/autouserinfo/sendBindMsg', bind.sendBindMsg);  
58 -router.post('/autouserinfo/checkBindMsg', bind.checkBindMsg);  
59 -router.post('/autouserinfo/bindMobile', bind.bindMobile); 60 +router.post('/passport/autouserinfo/bindCheck', bind.bindCheck);
  61 +router.post('/passport/autouserinfo/sendBindMsg', bind.sendBindMsg);
  62 +router.post('/passport/autouserinfo/checkBindMsg', bind.checkBindMsg);
  63 +router.post('/passport/autouserinfo/bindMobile', bind.bindMobile);
60 64
61 /** 65 /**
62 * 注册页面路由 66 * 注册页面路由
63 */ 67 */
64 -router.get('/reg/index', reg.index);  
65 -router.post('/reg/checkmobile', reg.checkMobileMiddleware, reg.checkMobile);  
66 -router.post('/reg/piccaptcha', reg.checkCode, reg.picCaptcha);  
67 -router.post('/reg/msgcaptcha', reg.checkMobileMiddleware, reg.msgCaptcha);  
68 -router.post('/reg/sendBindMsg', reg.checkMobileMiddleware, reg.checkCode, reg.sendBindMsg);  
69 -router.post('/reg/mobileregister', reg.checkMobileMiddleware, reg.checkPassword, reg.checkCode, reg.mobileRegister);  
70 -router.get('/reg/success', reg.success); 68 +router.get('/passport/reg/index', reg.index);
  69 +router.post('/passport/reg/checkmobile', reg.checkMobileMiddleware, reg.checkMobile);
  70 +router.post('/passport/reg/piccaptcha', reg.checkCode, reg.picCaptcha);
  71 +router.post('/passport/reg/msgcaptcha', reg.checkMobileMiddleware, reg.msgCaptcha);
  72 +router.post('/passport/reg/sendBindMsg', reg.checkMobileMiddleware, reg.checkCode, reg.sendBindMsg);
  73 +router.post('/passport/reg/mobileregister', reg.checkMobileMiddleware, reg.checkPassword, reg.checkCode, reg.mobileRegister);
  74 +router.get('/passport/reg/success', reg.success);
71 75
72 /** 76 /**
73 * 找回密码首页信息 77 * 找回密码首页信息
74 */ 78 */
75 // 找回密码首页 79 // 找回密码首页
76 -router.get('/back/index', back.index); 80 +router.get('/passport/back/index', back.index);
77 81
78 // 实时验证输入是否正确 82 // 实时验证输入是否正确
79 -router.post('/back/authcode', 83 +router.post('/passport/back/authcode',
80 captcha.requiredAPI, 84 captcha.requiredAPI,
81 back.validateInputAPI, 85 back.validateInputAPI,
82 back.getUserInfoAPI); 86 back.getUserInfoAPI);
83 87
84 // 提交按钮邮件API 88 // 提交按钮邮件API
85 -router.post('/back/email', 89 +router.post('/passport/back/email',
86 captcha.requiredPage, 90 captcha.requiredPage,
87 back.validateInputPage, 91 back.validateInputPage,
88 back.sendCodePage, 92 back.sendCodePage,
89 back.saveInSession); 93 back.saveInSession);
90 94
91 // 提交按钮手机API 95 // 提交按钮手机API
92 -router.post('/back/mobile', 96 +router.post('/passport/back/mobile',
93 captcha.requiredPage, 97 captcha.requiredPage,
94 back.validateInputPage, 98 back.validateInputPage,
95 back.sendCodePage, 99 back.sendCodePage,
@@ -99,7 +103,7 @@ router.post('/back/mobile', @@ -99,7 +103,7 @@ router.post('/back/mobile',
99 * 邮件找回密码 103 * 邮件找回密码
100 */ 104 */
101 // 发送邮件成功页面 105 // 发送邮件成功页面
102 -router.get('/back/sendEmail', 106 +router.get('/passport/back/sendEmail',
103 back.validateEmailInSession, 107 back.validateEmailInSession,
104 back.sendEmailPage); 108 back.sendEmailPage);
105 109
@@ -107,18 +111,18 @@ router.get('/back/sendEmail', @@ -107,18 +111,18 @@ router.get('/back/sendEmail',
107 * 短信找回密码 111 * 短信找回密码
108 */ 112 */
109 // 验证手机短信页面 113 // 验证手机短信页面
110 -router.get('/back/verification', 114 +router.get('/passport/back/verification',
111 back.validateMobileInSession, 115 back.validateMobileInSession,
112 back.verifyCodeByMobilePage); 116 back.verifyCodeByMobilePage);
113 117
114 // 重新发送短信接口 118 // 重新发送短信接口
115 -router.post('/back/sendBackMobile', 119 +router.post('/passport/back/sendBackMobile',
116 captcha.requiredAPI, 120 captcha.requiredAPI,
117 back.validateMobileAPI, 121 back.validateMobileAPI,
118 back.sendBackMobileAPI); 122 back.sendBackMobileAPI);
119 123
120 // 验证手机验证码接口 124 // 验证手机验证码接口
121 -router.post('/back/backMobile', 125 +router.post('/passport/back/backMobile',
122 captcha.requiredAPI, 126 captcha.requiredAPI,
123 back.verifyCodeByMobileAPI); 127 back.verifyCodeByMobileAPI);
124 128
@@ -127,24 +131,24 @@ router.post('/back/backMobile', @@ -127,24 +131,24 @@ router.post('/back/backMobile',
127 */ 131 */
128 132
129 // 重置密码页面 133 // 重置密码页面
130 -router.get('/back/backcode', 134 +router.get('/passport/back/backcode',
131 back.validateExistCodePage, 135 back.validateExistCodePage,
132 back.validateCodeByMobilePage, 136 back.validateCodeByMobilePage,
133 back.validateCodeByEmailPage, 137 back.validateCodeByEmailPage,
134 back.resetPasswordPage); 138 back.resetPasswordPage);
135 139
136 // 重置密码接口 140 // 重置密码接口
137 -router.post('/back/update', 141 +router.post('/passport/back/update',
138 back.validateExistCodePage, 142 back.validateExistCodePage,
139 back.validateCodeByMobilePage, 143 back.validateCodeByMobilePage,
140 back.validatePwdPage, 144 back.validatePwdPage,
141 back.updatePwdAPI); 145 back.updatePwdAPI);
142 146
143 // 重置密码成功页面 147 // 重置密码成功页面
144 -router.get('/back/resetSuccess', 148 +router.get('/passport/back/resetSuccess',
145 back.validateSuccessStatusPage, 149 back.validateSuccessStatusPage,
146 back.resetPwdSuccessPage); 150 back.resetPwdSuccessPage);
147 151
148 -router.get('/images', captcha.generate); 152 +router.get('/passport/images', captcha.generate);
149 153
150 module.exports = router; 154 module.exports = router;
@@ -11,6 +11,6 @@ module.exports = app => { @@ -11,6 +11,6 @@ module.exports = app => {
11 // 业务模块 11 // 业务模块
12 app.use(require('./apps/channel')); // 频道页 12 app.use(require('./apps/channel')); // 频道页
13 app.use(require('./apps/activity')); // 专题活动等活动页面 13 app.use(require('./apps/activity')); // 专题活动等活动页面
  14 + app.use(require('./apps/passport')); // 登录注册
14 app.use('/product', require('./apps/product')); // 商品相关页面 15 app.use('/product', require('./apps/product')); // 商品相关页面
15 - app.use('/passport', require('./apps/passport')); // 登录注册  
16 }; 16 };