...
|
...
|
@@ -2,7 +2,7 @@ |
|
|
* @Author: Targaryen
|
|
|
* @Date: 2017-04-13 10:21:07
|
|
|
* @Last Modified by: Targaryen
|
|
|
* @Last Modified time: 2017-04-14 13:49:39
|
|
|
* @Last Modified time: 2017-04-14 16:49:51
|
|
|
*/
|
|
|
|
|
|
/* ********************
|
...
|
...
|
@@ -14,12 +14,16 @@ |
|
|
const reset = require('../models/reset');
|
|
|
|
|
|
const passwordResetPage = (req, res) => {
|
|
|
let passwordWeakObj = req.session.passwordWeak;
|
|
|
|
|
|
console.log(passwordWeakObj);
|
|
|
res.render('reset/password', {
|
|
|
width750: true,
|
|
|
module: 'passport',
|
|
|
page: 'reset',
|
|
|
pageStyle: 'passport-body',
|
|
|
title: '重置密码'
|
|
|
title: '重置密码',
|
|
|
canSkip: passwordWeakObj.canSkip === 'Y'
|
|
|
});
|
|
|
};
|
|
|
|
...
|
...
|
@@ -30,21 +34,22 @@ const passwordResetPage = (req, res) => { |
|
|
* @param {*} next
|
|
|
*/
|
|
|
const passwordReset = (req, res, next) => {
|
|
|
let uid = req.user.uid;
|
|
|
let token = req.body.token;
|
|
|
let passwordWeakObj = req.session.passwordWeak;
|
|
|
|
|
|
if (!uid || !token) {
|
|
|
if (!passwordWeakObj.uid || !passwordWeakObj.token) {
|
|
|
return res.json({
|
|
|
code: 400,
|
|
|
massage: '非法请求!'
|
|
|
massage: '非法请求'
|
|
|
});
|
|
|
}
|
|
|
|
|
|
req.session.passwordWeak = null;
|
|
|
|
|
|
reset.resetPassword({
|
|
|
uid: req.user.uid,
|
|
|
uid: passwordWeakObj.uid,
|
|
|
oldPwd: req.body.oldPwd,
|
|
|
newPwd: req.body.newPwd,
|
|
|
token: token
|
|
|
token: passwordWeakObj.token
|
|
|
}).then(result => {
|
|
|
res.json(result);
|
|
|
}).catch(next);
|
...
|
...
|
|