Authored by 郭成尧

reset-success

... ... @@ -64,6 +64,10 @@ function doPassportCallback(openId, nickname, sourceType, req, res) {
const common = {
beforeLogin: (req, res, next) => {
if (req.session.passwordWeak) {
return res.redirect('/passport/password/resetpage');
}
let refer = req.query.refer;
if (!refer) {
... ...
... ... @@ -2,7 +2,7 @@
* @Author: Targaryen
* @Date: 2017-04-13 10:21:07
* @Last Modified by: Targaryen
* @Last Modified time: 2017-04-18 09:55:57
* @Last Modified time: 2017-04-18 11:12:16
*/
/* ********************
... ... @@ -70,7 +70,28 @@ const passwordReset = (req, res, next) => {
}).catch(next);
};
/**
* 重置密码成功
* @param {*} req
* @param {*} res
*/
const passwordResetOkPage = (req, res) => {
res.clearCookie('_SPK');
res.cookie('_WX_PASS_LOGIN', true, {
domain: 'm.yohobuy.com'
});
res.render('reset/reset-success', {
width750: true,
module: 'passport',
page: 'reset-success',
pageStyle: 'passport-body',
title: '重置密码成功',
});
};
module.exports = {
passwordResetPage,
passwordReset
passwordReset,
passwordResetOkPage
};
... ...
... ... @@ -120,6 +120,7 @@ router.post('/passport/reg/setpassword', reg.guardStep(3), reg.setPassword);
router.get('/passport/password/resetpage', reset.passwordResetPage); // 重置密码页面
router.post('/passport/password/reset', reset.passwordReset); // 重置密码
router.get('/passport/password/resetsuccess', reset.passwordResetOkPage); // 重置成功
/**
* 密码找回
... ...
<div class="yoho-page passport-reset-page">
<div class="title">
<span>重置登录密码</span>
</div>
<div class="success-icon">
<span class="iconfont">&#xe648;</span>
</div>
<div class="success-tip">
<p>恭喜您!您已经成功修改了登录密码</p>
<p>3秒后自动跳转到登录页</p>
</div>
<div class="btn-group relogin">
<button class="btn" id="reLogin">重新登录</button>
</div>
</div>
\ No newline at end of file
... ...
const $ = require('yoho-jquery');
let reLoginBtn = $('#reLogin');
reLoginBtn.on('click', function() {
window.location.href = '/passport/login';
});
$(function() {
setTimeout(function() {
window.location.href = '/passport/login';
}, 3000);
});
... ...
... ... @@ -2,7 +2,7 @@
* @Author: Targaryen
* @Date: 2017-04-13 14:43:19
* @Last Modified by: Targaryen
* @Last Modified time: 2017-04-14 17:53:47
* @Last Modified time: 2017-04-18 11:36:23
*/
/* ***************
... ... @@ -21,7 +21,23 @@ let $oldPasswordInput = $('#oldPassword');
let $newPasswordInput = $('#newPassword');
let $eye = $resetForm.find('.eye');
let $sureResetBtn = $('#sureResetBtn');
let $ignoreBtn = $('#ignoreBtn');
// 登录按钮状态切换
function switchLoginBtnStatus() {
let active = ($oldPasswordInput.val() && $newPasswordInput.val()) ? true : false;
$sureResetBtn.toggleClass('active', active);
}
$oldPasswordInput.bind('input', function() {
switchLoginBtnStatus();
});
$newPasswordInput.bind('input', function() {
switchLoginBtnStatus();
});
/**
* 密码显示隐藏
... ... @@ -40,6 +56,10 @@ $eye.on('click', function() {
* 提交密码重置
*/
$sureResetBtn.on('click', function() {
if (!$sureResetBtn.hasClass('active')) {
return false;
}
// 简单的密码校验
if (!$oldPasswordInput.val() || !$newPasswordInput.val()) {
tip.show('请输入旧密码和新密码');
... ... @@ -62,21 +82,18 @@ $sureResetBtn.on('click', function() {
success: function(result) {
tip.show(result.message);
if (result.code === 200) {
setTimeout(function() {
window.location.href = '/passport/login';
}, 500);
let href = '/passport/password/resetsuccess';
if (result.code !== 200) {
href = '/passport/login';
}
setTimeout(function() {
window.location.href = href;
}, 500);
},
error: function() {
tip.show('系统异常!');
}
});
});
/**
* 跳过弱密码校验
*/
$ignoreBtn.on('click', function() {
location.href = '/passport/login?isskip=Y';
});
... ...
... ... @@ -104,5 +104,36 @@
.reset-sure {
margin-top: 52px;
.active {
background-color: #78db7e;
color: #fff;
}
}
.success-icon {
text-align: center;
color: #fff;
margin-top: 120px;
.iconfont {
font-size: 60px;
}
}
.success-tip {
margin-top: 120px;
color: #fff;
font-size: 28px;
text-align: center;
}
.relogin {
margin-top: 52px;
.btn {
background-color: #78db7e;
color: #fff;
}
}
}
... ...