Showing
7 changed files
with
79 additions
and
1 deletions
apps/passport/controllers/reset.js
0 → 100644
1 | +/* | ||
2 | + * @Author: Targaryen | ||
3 | + * @Date: 2017-04-13 10:21:07 | ||
4 | + * @Last Modified by: Targaryen | ||
5 | + * @Last Modified time: 2017-04-13 11:05:58 | ||
6 | + */ | ||
7 | + | ||
8 | +/* ******************** | ||
9 | + * 重置密码 | ||
10 | + **********************/ | ||
11 | + | ||
12 | +'use strict'; | ||
13 | + | ||
14 | +const reset = require('../models/reset'); | ||
15 | + | ||
16 | +const passwordResetPage = (req, res) => { | ||
17 | + res.render('reset/password', { | ||
18 | + module: 'passport', | ||
19 | + page: 'reset', | ||
20 | + title: '重置密码' | ||
21 | + }); | ||
22 | +}; | ||
23 | + | ||
24 | +/** | ||
25 | + * 重置密码 | ||
26 | + * @param {*} req | ||
27 | + * @param {*} res | ||
28 | + * @param {*} next | ||
29 | + */ | ||
30 | +const passwordReset = (req, res, next) => { | ||
31 | + reset.resetPassword({ | ||
32 | + | ||
33 | + }).then(result => { | ||
34 | + res.json(result); | ||
35 | + }).catch(next); | ||
36 | +}; | ||
37 | + | ||
38 | +module.exports = { | ||
39 | + passwordResetPage, | ||
40 | + passwordReset | ||
41 | +}; |
apps/passport/models/reset.js
0 → 100644
1 | +/* | ||
2 | + * @Author: Targaryen | ||
3 | + * @Date: 2017-04-13 10:25:56 | ||
4 | + * @Last Modified by: Targaryen | ||
5 | + * @Last Modified time: 2017-04-13 10:29:26 | ||
6 | + */ | ||
7 | + | ||
8 | +/* ****************** | ||
9 | + * 重置密码 | ||
10 | + ********************/ | ||
11 | + | ||
12 | +'use strict'; | ||
13 | + | ||
14 | +const api = global.yoho.API; | ||
15 | + | ||
16 | +/** | ||
17 | + * 重置密码 | ||
18 | + * @param {*} params | ||
19 | + */ | ||
20 | +const resetPassword = (params) => { | ||
21 | + return api.post('', { | ||
22 | + method: '', | ||
23 | + oldPassword: params.oldPassword, | ||
24 | + newPassword: params.newPassword, | ||
25 | + username: params.username | ||
26 | + }); | ||
27 | +}; | ||
28 | + | ||
29 | +module.exports = { | ||
30 | + resetPassword | ||
31 | +}; |
@@ -11,6 +11,7 @@ const login = require('./controllers/login'); | @@ -11,6 +11,7 @@ const login = require('./controllers/login'); | ||
11 | const back = require('./controllers/back'); | 11 | const back = require('./controllers/back'); |
12 | const bind = require('./controllers/bind'); | 12 | const bind = require('./controllers/bind'); |
13 | const reg = require('./controllers/reg'); | 13 | const reg = require('./controllers/reg'); |
14 | +const reset = require('./controllers/reset'); | ||
14 | 15 | ||
15 | const disableBFCahce = require('../../doraemon/middleware/disable-BFCache'); | 16 | const disableBFCahce = require('../../doraemon/middleware/disable-BFCache'); |
16 | 17 | ||
@@ -117,6 +118,9 @@ router.post('/passport/reg/verifycode', reg.guardStep(2), reg.verifyCode); | @@ -117,6 +118,9 @@ router.post('/passport/reg/verifycode', reg.guardStep(2), reg.verifyCode); | ||
117 | router.get('/passport/reg/password', reg.guardStep(3), reg.password); | 118 | router.get('/passport/reg/password', reg.guardStep(3), reg.password); |
118 | router.post('/passport/reg/setpassword', reg.guardStep(3), reg.setPassword); | 119 | router.post('/passport/reg/setpassword', reg.guardStep(3), reg.setPassword); |
119 | 120 | ||
121 | +router.get('/passport/password/resetpage', reset.passwordResetPage); // 重置密码页面 | ||
122 | +router.post('/passport/password/reset', reset.passwordReset); // 重置密码 | ||
123 | + | ||
120 | /** | 124 | /** |
121 | * 密码找回 | 125 | * 密码找回 |
122 | */ | 126 | */ |
public/js/passport/reset.page.js
0 → 100644
1 | +require('common'); |
public/scss/passport/_reset.css
0 → 100644
-
Please register or login to post a comment