system-phone 3.1.93 → 3.1.95
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/components/LoginApp.vue +8 -4
- package/src/components/ModifyPassWord.vue +279 -220
- package/src/components/PhoneSellInfo.vue +148 -148
- package/src/filiale/gongyi/LoginApp.vue +8 -4
- package/src/filiale/kelamayi/LoginAppV4.vue +9 -4
- package/src/filiale/liaoyuan/LoginApp.vue +8 -4
- package/src/filiale/yuansheng/LoginApp.vue +8 -4
- package/src/filiale/yulinyuchuan/LoginApp.vue +9 -4
- package/src/filiale/yulinyuchuanTY/LoginApp.vue +9 -4
- package/src/plugins/validateStrongPasswordPhone.js +138 -125
|
@@ -1,172 +1,185 @@
|
|
|
1
1
|
const REG_STRONG_PWD =
|
|
2
|
-
/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[!@#$%^&*()
|
|
2
|
+
/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[!@#$%^&*(),.?":{}|<>~`+=_\\-])[A-Za-z\d!@#$%^&*(),.?":{}|<>~`+=_\\-]{12,16}$/
|
|
3
3
|
|
|
4
|
-
// 常见密码列表(可以根据需要扩展)
|
|
5
4
|
const COMMON_PASSWORDS = [
|
|
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
|
-
|
|
5
|
+
'password',
|
|
6
|
+
'password123',
|
|
7
|
+
'123456',
|
|
8
|
+
'12345678',
|
|
9
|
+
'qwerty',
|
|
10
|
+
'abc123',
|
|
11
|
+
'Password1',
|
|
12
|
+
'password1',
|
|
13
|
+
'123456789',
|
|
14
|
+
'welcome',
|
|
15
|
+
'admin',
|
|
16
|
+
'letmein',
|
|
17
|
+
'monkey',
|
|
18
|
+
'dragon',
|
|
19
|
+
'master',
|
|
20
|
+
'superman',
|
|
21
|
+
'qwerty123',
|
|
22
|
+
'admin123',
|
|
23
|
+
'root',
|
|
24
|
+
'pass',
|
|
25
|
+
'test',
|
|
26
|
+
'guest',
|
|
27
|
+
'user',
|
|
28
|
+
'000000',
|
|
29
|
+
'111111',
|
|
30
|
+
'666666',
|
|
31
|
+
'888888',
|
|
32
|
+
'999999',
|
|
33
|
+
'iloveyou',
|
|
34
|
+
'welcome123',
|
|
35
|
+
'password!',
|
|
36
|
+
'Passw0rd!',
|
|
37
|
+
'Passw0rd',
|
|
38
|
+
'Password!',
|
|
39
|
+
'passw0rd',
|
|
40
|
+
'P@ssw0rd',
|
|
41
|
+
'P@ssword',
|
|
42
|
+
'Password@123'
|
|
43
|
+
]
|
|
44
|
+
|
|
45
|
+
export const PASSWORD_RULE_HINT = '密码长度须为 12-16 位,包含大小写字母、数字与特殊符号。'
|
|
46
|
+
|
|
47
|
+
export const PASSWORD_DEFAULT_ERROR = '新密码必须包含大小写字母、数字和特殊字符,且长度为12-16位'
|
|
48
|
+
|
|
49
|
+
function hasConsecutiveNumbers (password) {
|
|
48
50
|
for (let i = 0; i <= password.length - 3; i++) {
|
|
49
|
-
const substr = password.substring(i, i + 3)
|
|
51
|
+
const substr = password.substring(i, i + 3)
|
|
50
52
|
if (/^\d{3,}$/.test(substr)) {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
let isConsecutive = true;
|
|
53
|
+
const digits = substr.split('').map(Number)
|
|
54
|
+
let isConsecutive = true
|
|
54
55
|
for (let j = 1; j < digits.length; j++) {
|
|
55
56
|
if (digits[j] !== digits[j - 1] + 1) {
|
|
56
|
-
isConsecutive = false
|
|
57
|
-
break
|
|
57
|
+
isConsecutive = false
|
|
58
|
+
break
|
|
58
59
|
}
|
|
59
60
|
}
|
|
60
|
-
if (isConsecutive) return true
|
|
61
|
+
if (isConsecutive) return true
|
|
61
62
|
}
|
|
62
63
|
}
|
|
63
|
-
return false
|
|
64
|
-
}
|
|
64
|
+
return false
|
|
65
|
+
}
|
|
65
66
|
|
|
66
|
-
|
|
67
|
-
const
|
|
68
|
-
const lowerPassword = password.toLowerCase();
|
|
67
|
+
function hasConsecutiveLetters (password) {
|
|
68
|
+
const lowerPassword = password.toLowerCase()
|
|
69
69
|
for (let i = 0; i <= lowerPassword.length - 3; i++) {
|
|
70
|
-
const substr = lowerPassword.substring(i, i + 3)
|
|
70
|
+
const substr = lowerPassword.substring(i, i + 3)
|
|
71
71
|
if (/^[a-z]{3,}$/.test(substr)) {
|
|
72
|
-
|
|
73
|
-
let isConsecutive = true;
|
|
72
|
+
let isConsecutive = true
|
|
74
73
|
for (let j = 1; j < substr.length; j++) {
|
|
75
74
|
if (substr.charCodeAt(j) !== substr.charCodeAt(j - 1) + 1) {
|
|
76
|
-
isConsecutive = false
|
|
77
|
-
break
|
|
75
|
+
isConsecutive = false
|
|
76
|
+
break
|
|
78
77
|
}
|
|
79
78
|
}
|
|
80
|
-
if (isConsecutive) return true
|
|
79
|
+
if (isConsecutive) return true
|
|
81
80
|
}
|
|
82
81
|
}
|
|
83
|
-
return false
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
const
|
|
93
|
-
|
|
94
|
-
const lowerPassword = password.toLowerCase();
|
|
82
|
+
return false
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function hasRepeatedChars (password) {
|
|
86
|
+
return /(.)\1{2,}/.test(password)
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function hasKeyboardPattern (password) {
|
|
90
|
+
const keyboardRows = ['qwertyuiop', 'asdfghjkl', 'zxcvbnm', '1234567890']
|
|
91
|
+
const lowerPassword = password.toLowerCase()
|
|
92
|
+
|
|
95
93
|
for (const row of keyboardRows) {
|
|
96
94
|
for (let i = 0; i <= row.length - 3; i++) {
|
|
97
|
-
const pattern = row.substring(i, i + 3)
|
|
95
|
+
const pattern = row.substring(i, i + 3)
|
|
98
96
|
if (lowerPassword.includes(pattern)) {
|
|
99
|
-
return true
|
|
97
|
+
return true
|
|
100
98
|
}
|
|
101
99
|
}
|
|
102
100
|
}
|
|
103
|
-
return false
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
* 密码校验结果对象
|
|
108
|
-
* @typedef {Object} PasswordValidationResult
|
|
109
|
-
* @property {boolean} isValid
|
|
110
|
-
* @property {string[]} errors
|
|
111
|
-
*/
|
|
112
|
-
|
|
113
|
-
/**
|
|
114
|
-
* 增强的密码校验函数
|
|
115
|
-
* @param {string} password
|
|
116
|
-
* @returns {PasswordValidationResult}
|
|
117
|
-
*/
|
|
101
|
+
return false
|
|
102
|
+
}
|
|
103
|
+
|
|
118
104
|
export const validateStrongPasswordPhone = (password) => {
|
|
119
105
|
const result = {
|
|
120
106
|
isValid: true,
|
|
121
|
-
errors: []
|
|
122
|
-
}
|
|
107
|
+
errors: []
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
if (!password) {
|
|
111
|
+
result.isValid = false
|
|
112
|
+
result.errors.push('不能为空')
|
|
113
|
+
return result
|
|
114
|
+
}
|
|
123
115
|
|
|
124
|
-
// 1. 基本格式校验
|
|
125
116
|
if (!REG_STRONG_PWD.test(password)) {
|
|
126
|
-
result.isValid = false
|
|
127
|
-
result.errors.push(
|
|
128
|
-
|
|
129
|
-
);
|
|
130
|
-
return result;
|
|
117
|
+
result.isValid = false
|
|
118
|
+
result.errors.push('密码长度须为12-16位,且包含大写字母、小写字母、数字和特殊字符')
|
|
119
|
+
return result
|
|
131
120
|
}
|
|
132
121
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
) {
|
|
138
|
-
result.isValid = false;
|
|
139
|
-
result.errors.push("不能使用常见密码");
|
|
140
|
-
return result;
|
|
122
|
+
if (COMMON_PASSWORDS.includes(password) || COMMON_PASSWORDS.includes(password.toLowerCase())) {
|
|
123
|
+
result.isValid = false
|
|
124
|
+
result.errors.push('不能使用常见密码')
|
|
125
|
+
return result
|
|
141
126
|
}
|
|
142
127
|
|
|
143
|
-
// 3. 检查连续数字
|
|
144
128
|
if (hasConsecutiveNumbers(password)) {
|
|
145
|
-
result.isValid = false
|
|
146
|
-
result.errors.push(
|
|
147
|
-
return result
|
|
129
|
+
result.isValid = false
|
|
130
|
+
result.errors.push('不能包含连续数字')
|
|
131
|
+
return result
|
|
148
132
|
}
|
|
149
133
|
|
|
150
|
-
// 4. 检查连续字母
|
|
151
134
|
if (hasConsecutiveLetters(password)) {
|
|
152
|
-
result.isValid = false
|
|
153
|
-
result.errors.push(
|
|
154
|
-
return result
|
|
135
|
+
result.isValid = false
|
|
136
|
+
result.errors.push('不能包含连续字母')
|
|
137
|
+
return result
|
|
155
138
|
}
|
|
156
139
|
|
|
157
|
-
// 5. 检查重复字符
|
|
158
140
|
if (hasRepeatedChars(password)) {
|
|
159
|
-
result.isValid = false
|
|
160
|
-
result.errors.push(
|
|
161
|
-
return result
|
|
141
|
+
result.isValid = false
|
|
142
|
+
result.errors.push('不能包含3个或以上相同字符')
|
|
143
|
+
return result
|
|
162
144
|
}
|
|
163
145
|
|
|
164
|
-
// 6. 检查键盘模式
|
|
165
146
|
if (hasKeyboardPattern(password)) {
|
|
166
|
-
result.isValid = false
|
|
167
|
-
result.errors.push(
|
|
168
|
-
return result
|
|
147
|
+
result.isValid = false
|
|
148
|
+
result.errors.push('不能包含键盘连续按键模式')
|
|
149
|
+
return result
|
|
169
150
|
}
|
|
170
151
|
|
|
171
|
-
return result
|
|
172
|
-
}
|
|
152
|
+
return result
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export function isStrongPassword (password) {
|
|
156
|
+
return validateStrongPasswordPhone(password).isValid
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
export function getPasswordStrength (password) {
|
|
160
|
+
if (!password) {
|
|
161
|
+
return {
|
|
162
|
+
label: '未输入',
|
|
163
|
+
type: 'default',
|
|
164
|
+
desc: '请输入密码以查看强度',
|
|
165
|
+
visible: false
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
const { isValid, errors } = validateStrongPasswordPhone(password)
|
|
170
|
+
if (isValid) {
|
|
171
|
+
return {
|
|
172
|
+
label: '强',
|
|
173
|
+
type: 'success',
|
|
174
|
+
desc: '密码满足复杂度要求',
|
|
175
|
+
visible: true
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
return {
|
|
180
|
+
label: '弱',
|
|
181
|
+
type: 'error',
|
|
182
|
+
desc: errors[0] || '密码不满足安全要求',
|
|
183
|
+
visible: true
|
|
184
|
+
}
|
|
185
|
+
}
|