Authored by 郭成尧

password-reset

/*
* @Author: Targaryen
* @Date: 2017-04-13 10:21:07
* @Last Modified by: Targaryen
* @Last Modified time: 2017-04-13 11:05:58
*/
/* ********************
* 重置密码
**********************/
'use strict';
const reset = require('../models/reset');
const passwordResetPage = (req, res) => {
res.render('reset/password', {
module: 'passport',
page: 'reset',
title: '重置密码'
});
};
/**
* 重置密码
* @param {*} req
* @param {*} res
* @param {*} next
*/
const passwordReset = (req, res, next) => {
reset.resetPassword({
}).then(result => {
res.json(result);
}).catch(next);
};
module.exports = {
passwordResetPage,
passwordReset
};
... ...
/*
* @Author: Targaryen
* @Date: 2017-04-13 10:25:56
* @Last Modified by: Targaryen
* @Last Modified time: 2017-04-13 10:29:26
*/
/* ******************
* 重置密码
********************/
'use strict';
const api = global.yoho.API;
/**
* 重置密码
* @param {*} params
*/
const resetPassword = (params) => {
return api.post('', {
method: '',
oldPassword: params.oldPassword,
newPassword: params.newPassword,
username: params.username
});
};
module.exports = {
resetPassword
};
... ...
... ... @@ -11,6 +11,7 @@ const login = require('./controllers/login');
const back = require('./controllers/back');
const bind = require('./controllers/bind');
const reg = require('./controllers/reg');
const reset = require('./controllers/reset');
const disableBFCahce = require('../../doraemon/middleware/disable-BFCache');
... ... @@ -117,6 +118,9 @@ router.post('/passport/reg/verifycode', reg.guardStep(2), reg.verifyCode);
router.get('/passport/reg/password', reg.guardStep(3), reg.password);
router.post('/passport/reg/setpassword', reg.guardStep(3), reg.setPassword);
router.get('/passport/password/resetpage', reset.passwordResetPage); // 重置密码页面
router.post('/passport/password/reset', reset.passwordReset); // 重置密码
/**
* 密码找回
*/
... ...
require('common');
... ...
... ... @@ -8,4 +8,5 @@
@import "success";
@import "app-update";
@import "app-agreement";
@import "passport-captcha"
@import "passport-captcha";
@import "reset";
... ...