Authored by 毕凯

Merge remote-tracking branch 'origin/master' into release/6.2

... ... @@ -35,7 +35,7 @@ exports.orderDetailData = (req, res, next) => {
let refundReason = result[2];
if (!orderDetail || _.isEmpty(orderDetail)) {
return next(404);
return next();
}
Object.assign(orderDetail, {
... ...
const _ = require('lodash');
const co = Promise.coroutine;
const helpers = global.yoho.helpers;
const backService = require('../models/back-service');
const SIGN_IN = helpers.urlFormat('/signin.html');
class BackNew {
/**
* 通过手机找回密码
*/
backByMobile(req, res, next) {
_.set(req.session, 'backupCaptch.verifyResult', false);
if (req.session.captchaValidCount == null) { // eslint-disable-line
req.session.captchaValidCount = 5;
}
co(function* () {
let countrysResult = yield backService.getAreaDataAsync(); // 地区信息列表
let countrys = _.get(countrysResult, 'data', []);
res.render('back/mobile-new', {
width750: true,
localCss: true,
module: 'passport',
page: 'back-mobile-new',
countrys: countrys,
});
})().catch(next);
}
/**
* 提交表单数据处理,设置新的密码
*/
setNewPasswordByMobileAPI(req, res, next) {
let phoneNum = req.body.phoneNum || '';
let code = req.body.code || '';
let areaCode = req.body.areaCode || '86';
let newPwd = req.body.password;
co(function* () {
let valiResult = yield backService.validateMobileCodeAsync(phoneNum, code, areaCode);
if (valiResult.code === 200) {
let token = _.get(valiResult, 'data.token', '');
let setPwdResult = yield backService.modifyPasswordByMobileAsyncAes(phoneNum, token, newPwd, areaCode);
if (setPwdResult.code === 200) {
res.json({
code: 200,
data: SIGN_IN
});
} else {
res.json({
code: 400,
message: '修改密码失败'
});
}
} else {
return res.json({
code: 400,
message: '验证码失败'
});
}
})().catch(next);
}
/**
* 通过邮箱找回密码
*/
backByEmail(req, res) {
res.render('back/email-new', {
width750: true,
localCss: true,
module: 'passport',
page: 'back-email-new'
});
}
/**
* 通过邮箱找回密码成功页
*/
backByEmailSuccess(req, res, next) {
let email = req.query.email || '';
if (!helpers.verifyEmail(email)) {
return next();
}
res.render('back/email-success-new', {
width750: true,
localCss: true,
module: 'passport',
page: 'back-email-success-new',
doneUrl: helpers.urlFormat('/signin.html'),
resendUrl: helpers.urlFormat('/passport/back/resendemail', { email: email })
});
}
}
module.exports = BackNew;
... ...
... ... @@ -82,11 +82,11 @@ class BackNew {
/**
* 通过邮箱找回密码成功页
*/
backByEmailSuccess(req, res) {
backByEmailSuccess(req, res, next) {
let email = req.query.email || '';
if (!helpers.verifyEmail(email)) {
res.redirect(400);
return next();
}
res.render('back/email-success-new', {
width750: true,
... ...
... ... @@ -114,7 +114,7 @@ class SmsLogin {
if (!req.xhr || step !== 2) {
return next(404);
return next();
}
let now = Date.now();
... ... @@ -182,7 +182,7 @@ class SmsLogin {
let step = _.get(req.session, 'smsLogin.step');
if (!req.xhr && step !== 2) {
return next(404);
return next();
}
if (!code) {
... ...
... ... @@ -11,8 +11,8 @@ const isProduction = process.env.NODE_ENV === 'production';
const isTest = process.env.NODE_ENV === 'test';
const domains = {
api: 'http://api.yoho.cn/',
service: 'http://service.yoho.cn/',
api: 'http://api.yoho.yohoops.org/',
service: 'http://service.yoho.yohoops.org/',
liveApi: 'http://testapi.live.yohops.com:9999/',
singleApi: 'http://api-test3.yohops.com:9999/',
imSocket: 'ws://socket.yohobuy.com:10240',
... ...
... ... @@ -347,7 +347,7 @@ function coupon(count, orderInfo, orderComputeData) {
info: ''
};
let couponAmount = _.get(orderComputeData, 'coupon_amount', false);
let couponAmount = _.get(orderComputeData, 'coupon_amount', 0);
if (_.get(orderInfo, 'usable_usual_code', null)) {
coupons.selectedAmount++;
... ...