Authored by shuaiguo

还原滑块验证

... ... @@ -183,9 +183,7 @@ class Reg {
let smsCode = +req.body.smsCode;
let inviteCode = req.body.inviteCode || '';
let isFromMy = _.get(req.session, 'phoneReg.isFromMy', '0');
// let token = req.body.token;
let token = '';
let token = req.body.token;
let clientIp = req.yoho.clientIp || '';
let from = req.cookies.from || 'yohobuy';
... ... @@ -199,10 +197,10 @@ class Reg {
}
// 判断是否允许访问
// if (!sign.verifyToken(mobile, token)) {
// postResult.message = '非法 token';
// return res.json(postResult);
// }
if (!sign.verifyToken(mobile, token)) {
postResult.message = '非法 token';
return res.json(postResult);
}
// 判断密码是否符合规则
if (!/^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,20}$/.test(password)) {
... ...
... ... @@ -139,7 +139,7 @@ router.get('/passport/img-check-risk.jpg', captcha.imgCheckRisk);
* 注册
*/
router.use('/passport/reg/*', disableBFCahce);
router.post('/passport/reg/verifymobile', reg.sendCodeBusyBoy, reg.verifyMobile);
router.post('/passport/reg/verifymobile', validateCode.check, reg.sendCodeBusyBoy, reg.verifyMobile);
// 新的登录注册
const LoginNew = require('./controllers/login-new');
... ... @@ -168,7 +168,7 @@ router.get('/passport/sms_login',
login.common.wechatQuickLoginCheck,
validateCode.load,
smsLogin.smsLoginPage); // 短信验证码登录
router.post('/passport/sms_login/step1_check', smsLogin.indexCheck);
router.post('/passport/sms_login/step1_check', validateCode.check, smsLogin.indexCheck);
router.get('/passport/sms_login/step1_check', (req, res, next) => {
if (!req.query.callback) {
return res.json({code: 400});
... ...
... ... @@ -24,6 +24,10 @@
<span
id="passwordEyeIcon" class="eye"><i class="iconfont eye-close">&#xe716;</i><i class="iconfont eye-open hide">&#xe714;</i></span>
</div>
<div class="form-group invite-code">
<label for="inviteCode" class="iconfont">&#xe71e;</label><input type="text" name="inviteCode" placeholder="好友潮流口令(非必填)" autocomplete="off" value="{{inviteValue}}">
</div>
<input name="token" type="hidden" value="{{token}}">
<div data-userverify="{{captchaShow}}" data-geetest="{{useGeetest}}" id="js-img-check"{{#unless useGeetest}} class="full-img-verify"{{/unless}}></div>
<button id="regBtn" class="reg-btn" type="button">注册</button>
<div class="protocol">
... ...
... ... @@ -263,31 +263,29 @@ class RegisterNew {
};
if (api.phoneRegx[areaCode].test(phoneNum) || areaCode !== '+86') {
// validate.getResults().then(result => {
// $.extend(params, result);
validate.getResults().then(result => {
$.extend(params, result);
$.ajax({
url: '/passport/reg/verifymobile',
type: 'POST',
data: params,
success: postResult => {
// validate.type === 2 && validate.refresh();
validate.type === 2 && validate.refresh();
if (postResult.code === 200) {
// this.view.tokenInput.val(postResult.data.token);
this.view.tokenInput.val(postResult.data.token);
this.countDown();
} else {
// (postResult.changeCaptcha && validate.type !== 2) && validate.refresh();
(postResult.changeCaptcha && validate.type !== 2) && validate.refresh();
showErrTip(postResult.message);
}
},
error: () => {
showErrTip('出错了,请重试');
// validate.refresh();
validate.refresh();
}
});
// });
});
} else {
showErrTip('手机号输入有错误');
}
... ...
... ... @@ -219,31 +219,30 @@ class SmsLoginNew extends Page {
return;
}
// validate.getResults().then(result => {
validate.getResults().then(result => {
let params = {
area: areaCode.replace('+', ''),
mobile: phone
};
// $.extend(params, result);
$.extend(params, result);
this.ajax({
method: 'POST',
url: '/passport/sms_login/step1_check',
data: params
}).then(data => {
// validate.type === 2 && validate.refresh();
validate.type === 2 && validate.refresh();
if (data.code === 200) {
checkPoint('YB_MOBILE_NEXT_C'); // 埋点
this.countDown();
} else {
// (data.changeCaptcha && validate.type !== 2) && validate.refresh();
(data.changeCaptcha && validate.type !== 2) && validate.refresh();
tip.show(data.message);
}
}).catch(() => {
// validate.refresh();
validate.refresh();
});
// });
});
}
/**
... ...