Authored by 郭成尧

ResetModel

... ... @@ -2,7 +2,6 @@
* @Author: Targaryen
* @Date: 2017-04-13 10:21:07
* @Last Modified by: Targaryen
* @Last Modified time: 2017-04-24 10:52:08
*/
/* ********************
... ... @@ -13,7 +12,7 @@
const config = global.yoho.config;
const utils = require(global.utils);
const reset = require('../models/reset');
const ResetModel = require('../models/reset');
const passwordResetPage = (req, res) => {
let passwordWeakObj = req.session.passwordWeak;
... ... @@ -60,7 +59,7 @@ const passwordReset = (req, res, next) => {
req.session.passwordWeak = null;
reset.resetPassword({
req.ctx(ResetModel).resetPassword({
uid: uid,
oldPwd: req.body.oldPwd,
newPwd: req.body.newPwd,
... ...
... ... @@ -2,7 +2,6 @@
* @Author: Targaryen
* @Date: 2017-04-13 10:25:56
* @Last Modified by: Targaryen
* @Last Modified time: 2017-04-14 17:07:09
*/
/* ******************
... ... @@ -10,24 +9,27 @@
********************/
'use strict';
const api = global.yoho.API;
const aes = require('./aes-pwd');
/**
* 重置密码
* @param {*} params
*/
const resetPassword = (params) => {
return api.post('', {
method: 'app.password.modPwdByCode',
uid: params.uid,
oldPwd: aes.aesPwd(params.oldPwd),
newPwd: aes.aesPwd(params.newPwd),
token: params.token
});
};
class ResetModel extends global.yoho.BaseModel {
constructor(ctx) {
super(ctx);
}
/**
* 重置密码
* @param {*} params
*/
resetPassword(params) {
return this.post({data: {
method: 'app.password.modPwdByCode',
uid: params.uid,
oldPwd: aes.aesPwd(params.oldPwd),
newPwd: aes.aesPwd(params.newPwd),
token: params.token
}});
}
}
module.exports = {
resetPassword
};
module.exports = ResetModel;
... ...