Merge remote-tracking branch 'origin/master' into release/6.2
Showing
6 changed files
with
109 additions
and
8 deletions
@@ -35,7 +35,7 @@ exports.orderDetailData = (req, res, next) => { | @@ -35,7 +35,7 @@ exports.orderDetailData = (req, res, next) => { | ||
35 | let refundReason = result[2]; | 35 | let refundReason = result[2]; |
36 | 36 | ||
37 | if (!orderDetail || _.isEmpty(orderDetail)) { | 37 | if (!orderDetail || _.isEmpty(orderDetail)) { |
38 | - return next(404); | 38 | + return next(); |
39 | } | 39 | } |
40 | 40 | ||
41 | Object.assign(orderDetail, { | 41 | Object.assign(orderDetail, { |
apps/passport/controllers/back-new.js
0 → 100644
1 | +const _ = require('lodash'); | ||
2 | +const co = Promise.coroutine; | ||
3 | +const helpers = global.yoho.helpers; | ||
4 | +const backService = require('../models/back-service'); | ||
5 | + | ||
6 | +const SIGN_IN = helpers.urlFormat('/signin.html'); | ||
7 | + | ||
8 | +class BackNew { | ||
9 | + /** | ||
10 | + * 通过手机找回密码 | ||
11 | + */ | ||
12 | + backByMobile(req, res, next) { | ||
13 | + _.set(req.session, 'backupCaptch.verifyResult', false); | ||
14 | + | ||
15 | + if (req.session.captchaValidCount == null) { // eslint-disable-line | ||
16 | + req.session.captchaValidCount = 5; | ||
17 | + } | ||
18 | + | ||
19 | + co(function* () { | ||
20 | + let countrysResult = yield backService.getAreaDataAsync(); // 地区信息列表 | ||
21 | + let countrys = _.get(countrysResult, 'data', []); | ||
22 | + | ||
23 | + res.render('back/mobile-new', { | ||
24 | + width750: true, | ||
25 | + localCss: true, | ||
26 | + module: 'passport', | ||
27 | + page: 'back-mobile-new', | ||
28 | + countrys: countrys, | ||
29 | + }); | ||
30 | + })().catch(next); | ||
31 | + } | ||
32 | + | ||
33 | + /** | ||
34 | + * 提交表单数据处理,设置新的密码 | ||
35 | + */ | ||
36 | + setNewPasswordByMobileAPI(req, res, next) { | ||
37 | + let phoneNum = req.body.phoneNum || ''; | ||
38 | + let code = req.body.code || ''; | ||
39 | + let areaCode = req.body.areaCode || '86'; | ||
40 | + let newPwd = req.body.password; | ||
41 | + | ||
42 | + co(function* () { | ||
43 | + let valiResult = yield backService.validateMobileCodeAsync(phoneNum, code, areaCode); | ||
44 | + | ||
45 | + if (valiResult.code === 200) { | ||
46 | + let token = _.get(valiResult, 'data.token', ''); | ||
47 | + let setPwdResult = yield backService.modifyPasswordByMobileAsyncAes(phoneNum, token, newPwd, areaCode); | ||
48 | + | ||
49 | + if (setPwdResult.code === 200) { | ||
50 | + res.json({ | ||
51 | + code: 200, | ||
52 | + data: SIGN_IN | ||
53 | + }); | ||
54 | + } else { | ||
55 | + res.json({ | ||
56 | + code: 400, | ||
57 | + message: '修改密码失败' | ||
58 | + }); | ||
59 | + } | ||
60 | + } else { | ||
61 | + return res.json({ | ||
62 | + code: 400, | ||
63 | + message: '验证码失败' | ||
64 | + }); | ||
65 | + } | ||
66 | + })().catch(next); | ||
67 | + } | ||
68 | + | ||
69 | + /** | ||
70 | + * 通过邮箱找回密码 | ||
71 | + */ | ||
72 | + backByEmail(req, res) { | ||
73 | + res.render('back/email-new', { | ||
74 | + width750: true, | ||
75 | + localCss: true, | ||
76 | + module: 'passport', | ||
77 | + page: 'back-email-new' | ||
78 | + }); | ||
79 | + } | ||
80 | + | ||
81 | + /** | ||
82 | + * 通过邮箱找回密码成功页 | ||
83 | + */ | ||
84 | + backByEmailSuccess(req, res, next) { | ||
85 | + let email = req.query.email || ''; | ||
86 | + | ||
87 | + if (!helpers.verifyEmail(email)) { | ||
88 | + return next(); | ||
89 | + } | ||
90 | + res.render('back/email-success-new', { | ||
91 | + width750: true, | ||
92 | + localCss: true, | ||
93 | + module: 'passport', | ||
94 | + page: 'back-email-success-new', | ||
95 | + doneUrl: helpers.urlFormat('/signin.html'), | ||
96 | + resendUrl: helpers.urlFormat('/passport/back/resendemail', { email: email }) | ||
97 | + }); | ||
98 | + } | ||
99 | +} | ||
100 | + | ||
101 | +module.exports = BackNew; |
@@ -82,11 +82,11 @@ class BackNew { | @@ -82,11 +82,11 @@ class BackNew { | ||
82 | /** | 82 | /** |
83 | * 通过邮箱找回密码成功页 | 83 | * 通过邮箱找回密码成功页 |
84 | */ | 84 | */ |
85 | - backByEmailSuccess(req, res) { | 85 | + backByEmailSuccess(req, res, next) { |
86 | let email = req.query.email || ''; | 86 | let email = req.query.email || ''; |
87 | 87 | ||
88 | if (!helpers.verifyEmail(email)) { | 88 | if (!helpers.verifyEmail(email)) { |
89 | - res.redirect(400); | 89 | + return next(); |
90 | } | 90 | } |
91 | res.render('back/email-success-new', { | 91 | res.render('back/email-success-new', { |
92 | width750: true, | 92 | width750: true, |
@@ -114,7 +114,7 @@ class SmsLogin { | @@ -114,7 +114,7 @@ class SmsLogin { | ||
114 | 114 | ||
115 | 115 | ||
116 | if (!req.xhr || step !== 2) { | 116 | if (!req.xhr || step !== 2) { |
117 | - return next(404); | 117 | + return next(); |
118 | } | 118 | } |
119 | 119 | ||
120 | let now = Date.now(); | 120 | let now = Date.now(); |
@@ -182,7 +182,7 @@ class SmsLogin { | @@ -182,7 +182,7 @@ class SmsLogin { | ||
182 | let step = _.get(req.session, 'smsLogin.step'); | 182 | let step = _.get(req.session, 'smsLogin.step'); |
183 | 183 | ||
184 | if (!req.xhr && step !== 2) { | 184 | if (!req.xhr && step !== 2) { |
185 | - return next(404); | 185 | + return next(); |
186 | } | 186 | } |
187 | 187 | ||
188 | if (!code) { | 188 | if (!code) { |
@@ -11,8 +11,8 @@ const isProduction = process.env.NODE_ENV === 'production'; | @@ -11,8 +11,8 @@ const isProduction = process.env.NODE_ENV === 'production'; | ||
11 | const isTest = process.env.NODE_ENV === 'test'; | 11 | const isTest = process.env.NODE_ENV === 'test'; |
12 | 12 | ||
13 | const domains = { | 13 | const domains = { |
14 | - api: 'http://api.yoho.cn/', | ||
15 | - service: 'http://service.yoho.cn/', | 14 | + api: 'http://api.yoho.yohoops.org/', |
15 | + service: 'http://service.yoho.yohoops.org/', | ||
16 | liveApi: 'http://testapi.live.yohops.com:9999/', | 16 | liveApi: 'http://testapi.live.yohops.com:9999/', |
17 | singleApi: 'http://api-test3.yohops.com:9999/', | 17 | singleApi: 'http://api-test3.yohops.com:9999/', |
18 | imSocket: 'ws://socket.yohobuy.com:10240', | 18 | imSocket: 'ws://socket.yohobuy.com:10240', |
@@ -347,7 +347,7 @@ function coupon(count, orderInfo, orderComputeData) { | @@ -347,7 +347,7 @@ function coupon(count, orderInfo, orderComputeData) { | ||
347 | info: '' | 347 | info: '' |
348 | }; | 348 | }; |
349 | 349 | ||
350 | - let couponAmount = _.get(orderComputeData, 'coupon_amount', false); | 350 | + let couponAmount = _.get(orderComputeData, 'coupon_amount', 0); |
351 | 351 | ||
352 | if (_.get(orderInfo, 'usable_usual_code', null)) { | 352 | if (_.get(orderInfo, 'usable_usual_code', null)) { |
353 | coupons.selectedAmount++; | 353 | coupons.selectedAmount++; |
-
Please register or login to post a comment