|
@@ -6,10 +6,13 @@ |
|
@@ -6,10 +6,13 @@ |
6
|
var $ = require('yoho-jquery');
|
6
|
var $ = require('yoho-jquery');
|
7
|
|
7
|
|
8
|
var $pwd = $('#pwd'),
|
8
|
var $pwd = $('#pwd'),
|
|
|
9
|
+ $pwdLint = $('.pwd-lint'),
|
|
|
10
|
+ $pwdLintTxt = $pwdLint.find('.pwd-lint-txt'),
|
9
|
$btnSure = $('#btn-sure');
|
11
|
$btnSure = $('#btn-sure');
|
10
|
|
12
|
|
11
|
var api = require('../api');
|
13
|
var api = require('../api');
|
12
|
var tip = require('../../plugin/tip');
|
14
|
var tip = require('../../plugin/tip');
|
|
|
15
|
+var validatePWD = require('../password-check');
|
13
|
|
16
|
|
14
|
var trim = $.trim;
|
17
|
var trim = $.trim;
|
15
|
var showErrTip = tip.show;
|
18
|
var showErrTip = tip.show;
|
|
@@ -53,11 +56,16 @@ api.bindEyesEvt({ |
|
@@ -53,11 +56,16 @@ api.bindEyesEvt({ |
53
|
});
|
56
|
});
|
54
|
|
57
|
|
55
|
$pwd.bind('input', function() {
|
58
|
$pwd.bind('input', function() {
|
56
|
- if (trim($pwd.val()) === '') {
|
|
|
57
|
- $btnSure.addClass('disable');
|
|
|
58
|
- } else {
|
|
|
59
|
- $btnSure.removeClass('disable');
|
59
|
+ var val = $.trim(this.value);
|
|
|
60
|
+ var bool = validatePWD(val, function(res) {
|
|
|
61
|
+ $pwdLint.css({visibility: res.valid ? 'hidden' : 'visible'});
|
|
|
62
|
+
|
|
|
63
|
+ if (!res.valid) {
|
|
|
64
|
+ $pwdLintTxt.text(res.msg);
|
60
|
}
|
65
|
}
|
|
|
66
|
+ });
|
|
|
67
|
+
|
|
|
68
|
+ $btnSure.toggleClass('disable', !bool);
|
61
|
});
|
69
|
});
|
62
|
|
70
|
|
63
|
$btnSure.on('touchstart', function() {
|
71
|
$btnSure.on('touchstart', function() {
|
|
@@ -67,7 +75,7 @@ $btnSure.on('touchstart', function() { |
|
@@ -67,7 +75,7 @@ $btnSure.on('touchstart', function() { |
67
|
return;
|
75
|
return;
|
68
|
}
|
76
|
}
|
69
|
|
77
|
|
70
|
- if (api.pwdValidate(pwd) === false) {
|
78
|
+ if (validatePWD(pwd) === false) {
|
71
|
showErrTip('密码6-20位,请重新输入');
|
79
|
showErrTip('密码6-20位,请重新输入');
|
72
|
} else {
|
80
|
} else {
|
73
|
startBind(pwd);
|
81
|
startBind(pwd);
|