Authored by 王水玲

第三方绑定

@@ -283,7 +283,6 @@ const setNewPasswordByMobileAPI = (req, res, next) => { @@ -283,7 +283,6 @@ const setNewPasswordByMobileAPI = (req, res, next) => {
283 283
284 service.modifyPasswordByMobileAsync(phoneNum, token, newPwd, areaCode) 284 service.modifyPasswordByMobileAsync(phoneNum, token, newPwd, areaCode)
285 .then(result => { 285 .then(result => {
286 - console.log(result);  
287 if (result.code === 200) { 286 if (result.code === 200) {
288 res.json({ 287 res.json({
289 code: 200, 288 code: 200,
@@ -200,10 +200,14 @@ const bind = { @@ -200,10 +200,14 @@ const bind = {
200 let refer = helpers.urlFormat('/passport/bind/success', { sourceType: sourceType }); 200 let refer = helpers.urlFormat('/passport/bind/success', { sourceType: sourceType });
201 201
202 if (result && result.code && result.code === 200 && result.data.uid) { 202 if (result && result.code && result.code === 200 && result.data.uid) {
203 - AuthHelper.syncUserSession(result.data.uid, req, res);  
204 - result.data.refer = refer; 203 + return AuthHelper.syncUserSession(result.data.uid, req, res).then(() => {
  204 + result.data.refer = refer;
  205 + return result;
  206 + });
  207 + } else {
  208 + return { code: 400, message: '绑定失败', data: '' };
205 } 209 }
206 - return result; 210 +
207 }).then(result => { 211 }).then(result => {
208 res.json(result); 212 res.json(result);
209 }).catch(next); 213 }).catch(next);
@@ -211,6 +211,7 @@ const qq = { @@ -211,6 +211,7 @@ const qq = {
211 log.error(`qq authenticate error : ${JSON.stringify(err)}`); 211 log.error(`qq authenticate error : ${JSON.stringify(err)}`);
212 return res.redirect(loginPage); 212 return res.redirect(loginPage);
213 } 213 }
  214 +
214 let nickname = user.nickname; 215 let nickname = user.nickname;
215 let openId = user.id; 216 let openId = user.id;
216 217
@@ -26,7 +26,7 @@ let index = (req, res) => { @@ -26,7 +26,7 @@ let index = (req, res) => {
26 26
27 res.render('reg/index', { 27 res.render('reg/index', {
28 title: '注册', 28 title: '注册',
29 - backUrl: 'javascript:history.go(-1)', // eslint-disable-line 29 + backUrl: 'javascript:history.go(-1)', // eslint-disable-line
30 headerText: '注册', // 头部信息 30 headerText: '注册', // 头部信息
31 isPassportPage: true, // 模板中模块标识 31 isPassportPage: true, // 模板中模块标识
32 areaCode: '+86', // 默认的区号 32 areaCode: '+86', // 默认的区号
@@ -22,7 +22,7 @@ class Auth { @@ -22,7 +22,7 @@ class Auth {
22 22
23 static signinAes(area, profile, password, shoppingKey) { 23 static signinAes(area, profile, password, shoppingKey) {
24 let param = { 24 let param = {
25 - method: 'app.passport.signin', 25 + method: 'app.passport.signinAES',
26 area: area, 26 area: area,
27 profile: profile, 27 profile: profile,
28 password: aes.aesPwd(password) 28 password: aes.aesPwd(password)
@@ -6,6 +6,7 @@ @@ -6,6 +6,7 @@
6 6
7 7
8 const api = global.yoho.API; 8 const api = global.yoho.API;
  9 +const aes = require('./aes-pwd');
9 10
10 const YOHOBUY_URL = 'http://www.yohobuy.com/'; 11 const YOHOBUY_URL = 'http://www.yohobuy.com/';
11 12
@@ -113,6 +114,16 @@ const modifyPasswordByMobileAsync = (mobile, token, newpwd, area) => { @@ -113,6 +114,16 @@ const modifyPasswordByMobileAsync = (mobile, token, newpwd, area) => {
113 }); 114 });
114 }; 115 };
115 116
  117 +const modifyPasswordByMobileAsyncAes = (mobile, token, newpwd, area) => {
  118 + return api.get('', {
  119 + mobile: mobile,
  120 + token: token,
  121 + newpwd: aes.aesPwd(newpwd),
  122 + area: area,
  123 + method: 'app.register.changepwdByMobileCodeAES'
  124 + });
  125 +};
  126 +
116 module.exports = { 127 module.exports = {
117 getAreaDataAsync, 128 getAreaDataAsync,
118 sendCodeToEmailAsync, 129 sendCodeToEmailAsync,
@@ -8,6 +8,7 @@ @@ -8,6 +8,7 @@
8 'use strict'; 8 'use strict';
9 9
10 const api = global.yoho.API; 10 const api = global.yoho.API;
  11 +const aes = require('./aes-pwd');
11 12
12 const RegService = { 13 const RegService = {
13 getAreaData() { 14 getAreaData() {
@@ -94,6 +95,20 @@ const RegService = { @@ -94,6 +95,20 @@ const RegService = {
94 } 95 }
95 96
96 return api.post('', params); 97 return api.post('', params);
  98 + },
  99 + regMobileEas(area, mobile, password, shoppingKey) {
  100 + let params = {
  101 + method: 'app.passport.registerAES',
  102 + area: area,
  103 + profile: mobile,
  104 + password: aes.aesPwd(password)
  105 + };
  106 +
  107 + if (shoppingKey) {
  108 + params.shopping_key = shoppingKey;
  109 + }
  110 +
  111 + return api.post('', params);
97 } 112 }
98 }; 113 };
99 114
@@ -2,28 +2,28 @@ @@ -2,28 +2,28 @@
2 color: #fefefe; 2 color: #fefefe;
3 3
4 .success-icon { 4 .success-icon {
5 - width: 74px;  
6 - height: 74px;  
7 - margin: 60px auto 30px; 5 + width: 74PX;
  6 + height: 74PX;
  7 + margin: 60PX auto 30PX;
8 background: resolve("passport/success.png"); 8 background: resolve("passport/success.png");
9 background-size: 100%; 9 background-size: 100%;
10 } 10 }
11 11
12 .success-tip { 12 .success-tip {
13 - padding: 10px;  
14 - font-size: 16px; 13 + padding: 10PX;
  14 + font-size: 16PX;
15 line-height: 1.5; 15 line-height: 1.5;
16 } 16 }
17 17
18 .go { 18 .go {
19 display: block; 19 display: block;
20 - margin: 30px auto;  
21 - width: 270px;  
22 - height: 40px;  
23 - font-size: 14px;  
24 - line-height: 40px; 20 + margin: 30PX auto;
  21 + width: 270PX;
  22 + height: 40PX;
  23 + font-size: 14PX;
  24 + line-height: 40PX;
25 color: #fff; 25 color: #fff;
26 background: rgba(255, 255, 255, 0.4); 26 background: rgba(255, 255, 255, 0.4);
27 - border-radius: 5px; 27 + border-radius: 5PX;
28 } 28 }
29 } 29 }