Authored by 郝肖肖

Merge branch 'feature/passReset' into release/5.6

... ... @@ -422,6 +422,10 @@ const validateMobileInSession = (req, res, next) => {
const weakPasswordPage = (req, res, next) => {
let refer = req.query.refer || helpers.urlFormat('/');
if (!req.session.CSToken && !req.session.canSkip) {
return res.redirect(refer);
}
passportHelper.getLeftBannerAsync().then(result => {
res.render('back/weak-pwd', Object.assign({
module: 'passport',
... ...
... ... @@ -38,6 +38,11 @@
</span>
</li>
<li class="input-container-li clearfix">
<div class="waak-repwd-tip">
<span class="hide">由字母、数字组合,不能包含特殊字符</span>
</div>
</li>
<li class="input-container-li clearfix">
<input id="reset-pwd-btn" class="btn reset-pwd-btn disable" type="button" value="重置登录密码" disabled="true">
</li>
<li class="input-container-li">
... ...
... ... @@ -12,6 +12,7 @@ var $pwd = $('#pwd'),
$pwdErr = $('#pwd-err'),
$repwdErr = $('#repwd-err'),
$titleTip = $('.title-tip'),
$waakRepwdTip = $('.waak-repwd-tip'),
$weakPwdPass = $('.weak-pwd-pass');
var pwdRegx = require('../common/mail-phone-regx').pwdValidateRegx;
... ... @@ -25,7 +26,7 @@ $('input').placeholder();
$('.va').keyup(function() {
var pass = true;
if ($(this).val() === '') {
if ($pwd.val() === '' || $repwd.val() === '') {
pass = false;
}
... ... @@ -51,9 +52,6 @@ $('.va').keyup(function() {
if (v === '') {
$this.addClass('error');
$pwdErr.removeClass('hide').find('em').text('请输入密码');
} else if (v.length < 6 || v.length > 20) {
$this.addClass('error');
$pwdErr.removeClass('hide').find('em').text('密码只支持6-20位');
}
} else {
if (v === '') {
... ... @@ -66,6 +64,8 @@ $('.va').keyup(function() {
$this.addClass('error');
$repwdErr.removeClass('hide').find('em').text('密码须字母和数字组合');
}
$waakRepwdTip.find('span').addClass('hide');
}
$(this).trigger('keyup');
... ... @@ -77,6 +77,7 @@ $('.va').keyup(function() {
$pwdErr.addClass('hide');
} else {
$repwdErr.addClass('hide');
$waakRepwdTip.find('span').removeClass('hide');
}
});
... ... @@ -92,17 +93,31 @@ $('#pwd, #repwd').keydown(function(e) {
$next.on('click', function() {
var refer = $weakPwdPass.data('href') || '/';
var $this = $(this);
// is frequent click
if ($this.data('is-execu')) {
return true;
}
$this.data('is-execu', true);
$.post('/passport/back/modPwdByCodeAPI', {
oldPwd: $pwd.val(),
newPwd: $repwd.val()
}, function(d) {
$this.data('is-execu', false);
if (d.code === 200) {
document.location.href = '//www.yohobuy.com/passport/back/weakSuccess?refer=' + refer;
return true;
} else if (d.code === 402) {
// token is error
document.location.href = '//www.yohobuy.com/reg.html?refer=' + refer;
document.location.href = '//www.yohobuy.com/signin.html?refer=' + refer;
return true;
} else if (d.code === 401) {
// token is error
$pwdErr.removeClass('hide').find('em').text(d.message);
return true;
}
... ...
... ... @@ -293,6 +293,13 @@
content: "\e6dc";
}
}
.waak-repwd-tip {
color: #b0b0b0;
margin-top: -10px;
font-size: 14px;
height: 10px;
}
}
}
... ...