-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathpassword.html
94 lines (93 loc) · 5.5 KB
/
password.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<!DOCTYPE html>
<html lang="en" style="background: url(bg.svg) center;background-size: cover;background-attachment: fixed;background-color: #dce3f3;">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>注册 - 尼科夫在线工具</title>
<link rel="stylesheet" href="style.css">
</head>
<body style="height:100%;background: none;display: flex;justify-content: center;">
<div class="box card" style="width: 40%;position: absolute;top:calc(50% - 125px);height: 250px;min-width: 500px;margin: 0;">
<p class="tit">注册</p>
<div class="body" style="padding: 0px 20px 20px 20px;">
<p id="error" style="color:red;margin: 0;opacity: 0;transition: 100ms;">Loading...</p>
<div style="display: flex;">
<p style="width: 50px;margin: 0;padding: 5px 0;">密码</p>
<input id="password" type="password" class="inp" style="flex-grow: 1;" value="">
</div>
<loading style="position: absolute;right: 80px;bottom: 10px;opacity: 0;transition: 100ms;" id="loading">
<svg width="28px" height="28px" viewBox="0 0 16 16"><circle cx="8px" cy="8px" r="7px"></circle><circle cx="8px" cy="8px" r="6px"></circle></svg>
</loading>
<a class="btn" style="position: absolute;right: 10px;bottom: 10px;" onclick="$('#error').css('opacity',0);$('#loading').css('opacity',1);setTimeout(() => {check()}, 500);">注册</a>
</div>
</div>
<script>
function check() {
let pw=$('#password').val();
// let pw='',er='';
if (pw.length<12) {
er='密码必须至少有12个字符,否则强度过低';
}else if(!/[a-zA-Z]/.test(pw)){
er='密码至少有一个字母,否则强度过低';
}else if(!/[0-9]/.test(pw)||pw.match(/[0-9]/g).length<3){
er='密码至少有3个数字,否则强度过低';
}else if(!/[a-z]/.test(pw)||pw.match(/[a-z]/g).length<3){
er='密码至少有3个小写字母,否则强度过低';
}else if(!/[A-Z]/.test(pw)||pw.match(/[A-Z]/g).length<3){
er='密码至少有5个大写字母,否则强度过低';
}else if(/[^a-zA-Z0-9_\-]/.test(pw)){
er='密码不能有特殊字符 ("_" 和 "-" 除外),否则不易识别';
}else if(!/_/.test(pw)){
er='密码至少有一个下划线,否则强度过低';
}else if(!/\-/.test(pw)){
er='密码至少有一个连字符,否则强度过低';
}else if(/[a-z]{3}/.test(pw)){
er='密码中不能连续有3个以上的小写字母,否则强度过低';
}else if(/[A-Z]{3}/.test(pw)){
er='密码中不能连续有3个以上的大写字母,否则强度过低';
}else if(/((?:0(?=1)|1(?=2)|2(?=3)|3(?=4)|4(?=5)|5(?=6)|6(?=7)|7(?=8)|8(?=9)|9(?=0)){2}\d)/.test(pw)){
er='密码中不能有3个以上连续递增数字,否则强度过低';
}else if(/((?:1(?=0)|2(?=1)|3(?=2)|4(?=3)|5(?=4)|6(?=5)|7(?=6)|8(?=7)|9(?=8)|0(?=9)){2}\d)/.test(pw)){
er='密码中不能有3个以上连续递减数字,否则强度过低';
}else if(/[0-9]{4}/.test(pw)){
er='密码中不能连续有4个以上的数字,否则强度过低';
}else if(/[a-zA-Z]{4}/.test(pw)){
er='密码中不能连续有4个以上的字母,否则强度过低';
}else if(/^[0-9_a-z]/.test(pw)){
er='密码的开头只能是大写字母,易于记忆';
}else if(/[0-9_a-z]$/.test(pw)){
er='密码的结尾只能是大写字母,易于记忆';
}else if(/(.).*\1/.test(pw)){
er='密码中不能有重复的字符,否则强度过低';
}else if(/[\-_]{2}/.test(pw)){
er='密码中不能连续有2个以上的特殊字符,否则强度过低';
}else if(/((?:\-(?=\d)|\d(?=\-))[\d\-])/.test(pw)){
er='密码中数字和连字符不能连在一起,否则可能误认为是减号';
}else if(/((?:_(?=[A-Z])|[A-Z](?=_))[_A-Z])/.test(pw)){
er='密码中大写字母和下划线不能连在一起,否则不符常理';
}else if(/[CMOPSUVWXZ]/.test(pw)){
er='密码中不能出现CMOPSUVWXZ这些大小写相似的字母的大写,否则可能误认,统一使用小写';
}else if(/[019]/.test(pw)){
er='密码中不能出现0,1,6,9这些数字,否则可能与o,i,b,q混淆';
}else if(/[\-_].{0,4}[\-_]/.test(pw)){
er='密码中特殊字符至少间隔5个字符,否则可能混淆';
}else if(/[sS][\-_]*[bB]/.test(pw)){
er='密码中不能出现sb';
}else if(/2[\-_]*[bB]/.test(pw)){
er='密码中不能出现2b';
}else if(pw.length>13){
er='密码必须最多有13个字符,否则不易记忆';
}else{
er='密码不符合条件,否则就注册成功了';
}
$('#error').text(er);
$('#error').css('opacity',1);
$('#loading').css('opacity',0);
}
// 标答 Ka_3Ab2Gc5D-E
</script>
<script src="../tapple/jq.min.js"></script>
<script src="../tapple/scroll.js"></script>
</body>
</html>