Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
yoho-blk
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
1
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
htoooth
9 years ago
Commit
ba721dfe7f4de0da76b8cbc3a51fb595c4aec3ac
1 parent
904af2ee
密码强度设置
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
12 deletions
public/js/passport/common/pwd-strength.js
public/js/passport/common/pwd-strength.js
View file @
ba721df
...
...
@@ -2,26 +2,26 @@
* 计算密码复杂度
*/
function
isAllNumberOrAlph
(
password
)
{
return
/^
[
0-9
]
+$/
.
test
(
password
)
||
/^
[
A-Za-z
]
+$/
.
test
(
password
)
||
password
.
length
===
0
?
0
:
1
;
}
function
computeComplex
(
password
)
{
var
lengthS
=
0
;
var
numS
=
0
;
var
length
=
password
.
length
;
if
(
length
<
6
)
{
lengthS
=
0
;
}
else
if
(
length
>
6
&&
length
<
16
)
{
lengthS
=
1
;
}
else
{
lengthS
=
2
;
}
if
(
/^
[
0-9
]
+$/
.
test
(
password
)
||
/^
[
A-Za-z
]
+$/
.
test
(
password
)
||
length
===
0
)
{
numS
=
0
;
if
(
length
===
0
)
{
lengthS
=
0
;
}
else
if
(
length
<=
6
&&
length
>
0
)
{
lengthS
=
0
+
isAllNumberOrAlph
(
password
);
}
else
if
(
length
>
6
&&
length
<=
16
)
{
lengthS
=
1
+
isAllNumberOrAlph
(
password
);
}
else
{
numS
=
1
;
lengthS
=
2
+
isAllNumberOrAlph
(
password
)
;
}
return
lengthS
+
numS
;
return
lengthS
;
}
module
.
exports
=
computeComplex
;
...
...
Please
register
or
login
to post a comment