Showing
7 changed files
with
119 additions
and
15 deletions
@@ -64,6 +64,10 @@ function doPassportCallback(openId, nickname, sourceType, req, res) { | @@ -64,6 +64,10 @@ function doPassportCallback(openId, nickname, sourceType, req, res) { | ||
64 | 64 | ||
65 | const common = { | 65 | const common = { |
66 | beforeLogin: (req, res, next) => { | 66 | beforeLogin: (req, res, next) => { |
67 | + if (req.session.passwordWeak) { | ||
68 | + return res.redirect('/passport/password/resetpage'); | ||
69 | + } | ||
70 | + | ||
67 | let refer = req.query.refer; | 71 | let refer = req.query.refer; |
68 | 72 | ||
69 | if (!refer) { | 73 | if (!refer) { |
@@ -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-18 09:55:57 | 5 | + * @Last Modified time: 2017-04-18 11:12:16 |
6 | */ | 6 | */ |
7 | 7 | ||
8 | /* ******************** | 8 | /* ******************** |
@@ -70,7 +70,28 @@ const passwordReset = (req, res, next) => { | @@ -70,7 +70,28 @@ const passwordReset = (req, res, next) => { | ||
70 | }).catch(next); | 70 | }).catch(next); |
71 | }; | 71 | }; |
72 | 72 | ||
73 | + | ||
74 | +/** | ||
75 | + * 重置密码成功 | ||
76 | + * @param {*} req | ||
77 | + * @param {*} res | ||
78 | + */ | ||
79 | +const passwordResetOkPage = (req, res) => { | ||
80 | + res.clearCookie('_SPK'); | ||
81 | + res.cookie('_WX_PASS_LOGIN', true, { | ||
82 | + domain: 'm.yohobuy.com' | ||
83 | + }); | ||
84 | + res.render('reset/reset-success', { | ||
85 | + width750: true, | ||
86 | + module: 'passport', | ||
87 | + page: 'reset-success', | ||
88 | + pageStyle: 'passport-body', | ||
89 | + title: '重置密码成功', | ||
90 | + }); | ||
91 | +}; | ||
92 | + | ||
73 | module.exports = { | 93 | module.exports = { |
74 | passwordResetPage, | 94 | passwordResetPage, |
75 | - passwordReset | 95 | + passwordReset, |
96 | + passwordResetOkPage | ||
76 | }; | 97 | }; |
@@ -120,6 +120,7 @@ router.post('/passport/reg/setpassword', reg.guardStep(3), reg.setPassword); | @@ -120,6 +120,7 @@ router.post('/passport/reg/setpassword', reg.guardStep(3), reg.setPassword); | ||
120 | 120 | ||
121 | router.get('/passport/password/resetpage', reset.passwordResetPage); // 重置密码页面 | 121 | router.get('/passport/password/resetpage', reset.passwordResetPage); // 重置密码页面 |
122 | router.post('/passport/password/reset', reset.passwordReset); // 重置密码 | 122 | router.post('/passport/password/reset', reset.passwordReset); // 重置密码 |
123 | +router.get('/passport/password/resetsuccess', reset.passwordResetOkPage); // 重置成功 | ||
123 | 124 | ||
124 | /** | 125 | /** |
125 | * 密码找回 | 126 | * 密码找回 |
1 | +<div class="yoho-page passport-reset-page"> | ||
2 | + <div class="title"> | ||
3 | + <span>重置登录密码</span> | ||
4 | + </div> | ||
5 | + | ||
6 | + <div class="success-icon"> | ||
7 | + <span class="iconfont"></span> | ||
8 | + </div> | ||
9 | + <div class="success-tip"> | ||
10 | + <p>恭喜您!您已经成功修改了登录密码</p> | ||
11 | + <p>3秒后自动跳转到登录页</p> | ||
12 | + </div> | ||
13 | + <div class="btn-group relogin"> | ||
14 | + <button class="btn" id="reLogin">重新登录</button> | ||
15 | + </div> | ||
16 | +</div> |
public/js/passport/reset-success.page.js
0 → 100644
@@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
2 | * @Author: Targaryen | 2 | * @Author: Targaryen |
3 | * @Date: 2017-04-13 14:43:19 | 3 | * @Date: 2017-04-13 14:43:19 |
4 | * @Last Modified by: Targaryen | 4 | * @Last Modified by: Targaryen |
5 | - * @Last Modified time: 2017-04-14 17:53:47 | 5 | + * @Last Modified time: 2017-04-18 11:36:23 |
6 | */ | 6 | */ |
7 | 7 | ||
8 | /* *************** | 8 | /* *************** |
@@ -21,7 +21,23 @@ let $oldPasswordInput = $('#oldPassword'); | @@ -21,7 +21,23 @@ let $oldPasswordInput = $('#oldPassword'); | ||
21 | let $newPasswordInput = $('#newPassword'); | 21 | let $newPasswordInput = $('#newPassword'); |
22 | let $eye = $resetForm.find('.eye'); | 22 | let $eye = $resetForm.find('.eye'); |
23 | let $sureResetBtn = $('#sureResetBtn'); | 23 | let $sureResetBtn = $('#sureResetBtn'); |
24 | -let $ignoreBtn = $('#ignoreBtn'); | 24 | + |
25 | + | ||
26 | +// 登录按钮状态切换 | ||
27 | +function switchLoginBtnStatus() { | ||
28 | + let active = ($oldPasswordInput.val() && $newPasswordInput.val()) ? true : false; | ||
29 | + | ||
30 | + $sureResetBtn.toggleClass('active', active); | ||
31 | +} | ||
32 | + | ||
33 | + | ||
34 | +$oldPasswordInput.bind('input', function() { | ||
35 | + switchLoginBtnStatus(); | ||
36 | +}); | ||
37 | + | ||
38 | +$newPasswordInput.bind('input', function() { | ||
39 | + switchLoginBtnStatus(); | ||
40 | +}); | ||
25 | 41 | ||
26 | /** | 42 | /** |
27 | * 密码显示隐藏 | 43 | * 密码显示隐藏 |
@@ -40,6 +56,10 @@ $eye.on('click', function() { | @@ -40,6 +56,10 @@ $eye.on('click', function() { | ||
40 | * 提交密码重置 | 56 | * 提交密码重置 |
41 | */ | 57 | */ |
42 | $sureResetBtn.on('click', function() { | 58 | $sureResetBtn.on('click', function() { |
59 | + if (!$sureResetBtn.hasClass('active')) { | ||
60 | + return false; | ||
61 | + } | ||
62 | + | ||
43 | // 简单的密码校验 | 63 | // 简单的密码校验 |
44 | if (!$oldPasswordInput.val() || !$newPasswordInput.val()) { | 64 | if (!$oldPasswordInput.val() || !$newPasswordInput.val()) { |
45 | tip.show('请输入旧密码和新密码'); | 65 | tip.show('请输入旧密码和新密码'); |
@@ -62,21 +82,18 @@ $sureResetBtn.on('click', function() { | @@ -62,21 +82,18 @@ $sureResetBtn.on('click', function() { | ||
62 | success: function(result) { | 82 | success: function(result) { |
63 | tip.show(result.message); | 83 | tip.show(result.message); |
64 | 84 | ||
65 | - if (result.code === 200) { | ||
66 | - setTimeout(function() { | ||
67 | - window.location.href = '/passport/login'; | ||
68 | - }, 500); | 85 | + let href = '/passport/password/resetsuccess'; |
86 | + | ||
87 | + if (result.code !== 200) { | ||
88 | + href = '/passport/login'; | ||
69 | } | 89 | } |
90 | + | ||
91 | + setTimeout(function() { | ||
92 | + window.location.href = href; | ||
93 | + }, 500); | ||
70 | }, | 94 | }, |
71 | error: function() { | 95 | error: function() { |
72 | tip.show('系统异常!'); | 96 | tip.show('系统异常!'); |
73 | } | 97 | } |
74 | }); | 98 | }); |
75 | }); | 99 | }); |
76 | - | ||
77 | -/** | ||
78 | - * 跳过弱密码校验 | ||
79 | - */ | ||
80 | -$ignoreBtn.on('click', function() { | ||
81 | - location.href = '/passport/login?isskip=Y'; | ||
82 | -}); |
@@ -104,5 +104,36 @@ | @@ -104,5 +104,36 @@ | ||
104 | 104 | ||
105 | .reset-sure { | 105 | .reset-sure { |
106 | margin-top: 52px; | 106 | margin-top: 52px; |
107 | + | ||
108 | + .active { | ||
109 | + background-color: #78db7e; | ||
110 | + color: #fff; | ||
111 | + } | ||
112 | + } | ||
113 | + | ||
114 | + .success-icon { | ||
115 | + text-align: center; | ||
116 | + color: #fff; | ||
117 | + margin-top: 120px; | ||
118 | + | ||
119 | + .iconfont { | ||
120 | + font-size: 60px; | ||
121 | + } | ||
122 | + } | ||
123 | + | ||
124 | + .success-tip { | ||
125 | + margin-top: 120px; | ||
126 | + color: #fff; | ||
127 | + font-size: 28px; | ||
128 | + text-align: center; | ||
129 | + } | ||
130 | + | ||
131 | + .relogin { | ||
132 | + margin-top: 52px; | ||
133 | + | ||
134 | + .btn { | ||
135 | + background-color: #78db7e; | ||
136 | + color: #fff; | ||
137 | + } | ||
107 | } | 138 | } |
108 | } | 139 | } |
-
Please register or login to post a comment