Authored by 郭成尧

reset-api-method

@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 * @Author: Targaryen 2 * @Author: Targaryen
3 * @Date: 2017-04-13 10:21:07 3 * @Date: 2017-04-13 10:21:07
4 * @Last Modified by: Targaryen 4 * @Last Modified by: Targaryen
5 - * @Last Modified time: 2017-04-13 14:01:50 5 + * @Last Modified time: 2017-04-14 13:49:39
6 */ 6 */
7 7
8 /* ******************** 8 /* ********************
@@ -30,8 +30,21 @@ const passwordResetPage = (req, res) => { @@ -30,8 +30,21 @@ const passwordResetPage = (req, res) => {
30 * @param {*} next 30 * @param {*} next
31 */ 31 */
32 const passwordReset = (req, res, next) => { 32 const passwordReset = (req, res, next) => {
33 - reset.resetPassword({ 33 + let uid = req.user.uid;
  34 + let token = req.body.token;
  35 +
  36 + if (!uid || !token) {
  37 + return res.json({
  38 + code: 400,
  39 + massage: '非法请求!'
  40 + });
  41 + }
34 42
  43 + reset.resetPassword({
  44 + uid: req.user.uid,
  45 + oldPwd: req.body.oldPwd,
  46 + newPwd: req.body.newPwd,
  47 + token: token
35 }).then(result => { 48 }).then(result => {
36 res.json(result); 49 res.json(result);
37 }).catch(next); 50 }).catch(next);
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 * @Author: Targaryen 2 * @Author: Targaryen
3 * @Date: 2017-04-13 10:25:56 3 * @Date: 2017-04-13 10:25:56
4 * @Last Modified by: Targaryen 4 * @Last Modified by: Targaryen
5 - * @Last Modified time: 2017-04-13 10:29:26 5 + * @Last Modified time: 2017-04-14 13:48:19
6 */ 6 */
7 7
8 /* ****************** 8 /* ******************
@@ -19,10 +19,11 @@ const api = global.yoho.API; @@ -19,10 +19,11 @@ const api = global.yoho.API;
19 */ 19 */
20 const resetPassword = (params) => { 20 const resetPassword = (params) => {
21 return api.post('', { 21 return api.post('', {
22 - method: '',  
23 - oldPassword: params.oldPassword,  
24 - newPassword: params.newPassword,  
25 - username: params.username 22 + method: 'app.password.modPwdByCode',
  23 + uid: params.uid,
  24 + oldPwd: params.oldPwd,
  25 + newPwd: params.newPwd,
  26 + token: params.token
26 }); 27 });
27 }; 28 };
28 29
@@ -13,8 +13,8 @@ const domains = { @@ -13,8 +13,8 @@ const domains = {
13 liveApi: 'http://testapi.live.yohops.com:9999/', 13 liveApi: 'http://testapi.live.yohops.com:9999/',
14 singleApi: 'http://api-test3.yohops.com:9999/', 14 singleApi: 'http://api-test3.yohops.com:9999/',
15 15
16 - api: 'http://api.yoho.cn/',  
17 - service: 'http://service.yoho.cn/', 16 + api: 'http://api-test3.yohops.com:9999/',
  17 + service: 'http://service-test3.yohops.com:9999/',
18 18
19 // liveApi: 'http://api.live.yoho.cn/', 19 // liveApi: 'http://api.live.yoho.cn/',
20 // singleApi: 'http://single.yoho.cn/', 20 // singleApi: 'http://single.yoho.cn/',