Authored by 王水玲

第三方绑定

... ... @@ -283,7 +283,6 @@ const setNewPasswordByMobileAPI = (req, res, next) => {
service.modifyPasswordByMobileAsync(phoneNum, token, newPwd, areaCode)
.then(result => {
console.log(result);
if (result.code === 200) {
res.json({
code: 200,
... ...
... ... @@ -200,10 +200,14 @@ const bind = {
let refer = helpers.urlFormat('/passport/bind/success', { sourceType: sourceType });
if (result && result.code && result.code === 200 && result.data.uid) {
AuthHelper.syncUserSession(result.data.uid, req, res);
result.data.refer = refer;
return AuthHelper.syncUserSession(result.data.uid, req, res).then(() => {
result.data.refer = refer;
return result;
});
} else {
return { code: 400, message: '绑定失败', data: '' };
}
return result;
}).then(result => {
res.json(result);
}).catch(next);
... ...
... ... @@ -211,6 +211,7 @@ const qq = {
log.error(`qq authenticate error : ${JSON.stringify(err)}`);
return res.redirect(loginPage);
}
let nickname = user.nickname;
let openId = user.id;
... ...
... ... @@ -26,7 +26,7 @@ let index = (req, res) => {
res.render('reg/index', {
title: '注册',
backUrl: 'javascript:history.go(-1)', // eslint-disable-line
backUrl: 'javascript:history.go(-1)', // eslint-disable-line
headerText: '注册', // 头部信息
isPassportPage: true, // 模板中模块标识
areaCode: '+86', // 默认的区号
... ...
... ... @@ -22,7 +22,7 @@ class Auth {
static signinAes(area, profile, password, shoppingKey) {
let param = {
method: 'app.passport.signin',
method: 'app.passport.signinAES',
area: area,
profile: profile,
password: aes.aesPwd(password)
... ...
... ... @@ -6,6 +6,7 @@
const api = global.yoho.API;
const aes = require('./aes-pwd');
const YOHOBUY_URL = 'http://www.yohobuy.com/';
... ... @@ -113,6 +114,16 @@ const modifyPasswordByMobileAsync = (mobile, token, newpwd, area) => {
});
};
const modifyPasswordByMobileAsyncAes = (mobile, token, newpwd, area) => {
return api.get('', {
mobile: mobile,
token: token,
newpwd: aes.aesPwd(newpwd),
area: area,
method: 'app.register.changepwdByMobileCodeAES'
});
};
module.exports = {
getAreaDataAsync,
sendCodeToEmailAsync,
... ...
... ... @@ -8,6 +8,7 @@
'use strict';
const api = global.yoho.API;
const aes = require('./aes-pwd');
const RegService = {
getAreaData() {
... ... @@ -94,6 +95,20 @@ const RegService = {
}
return api.post('', params);
},
regMobileEas(area, mobile, password, shoppingKey) {
let params = {
method: 'app.passport.registerAES',
area: area,
profile: mobile,
password: aes.aesPwd(password)
};
if (shoppingKey) {
params.shopping_key = shoppingKey;
}
return api.post('', params);
}
};
... ...
... ... @@ -2,28 +2,28 @@
color: #fefefe;
.success-icon {
width: 74px;
height: 74px;
margin: 60px auto 30px;
width: 74PX;
height: 74PX;
margin: 60PX auto 30PX;
background: resolve("passport/success.png");
background-size: 100%;
}
.success-tip {
padding: 10px;
font-size: 16px;
padding: 10PX;
font-size: 16PX;
line-height: 1.5;
}
.go {
display: block;
margin: 30px auto;
width: 270px;
height: 40px;
font-size: 14px;
line-height: 40px;
margin: 30PX auto;
width: 270PX;
height: 40PX;
font-size: 14PX;
line-height: 40PX;
color: #fff;
background: rgba(255, 255, 255, 0.4);
border-radius: 5px;
border-radius: 5PX;
}
}
... ...