|
|
@@ -771,11 +771,31 @@ export default {
|
|
|
this.form.password = "";
|
|
|
});
|
|
|
},
|
|
|
+ // 密码复杂性校验方法
|
|
|
+ validatePassword(value) {
|
|
|
+ if (!value) {
|
|
|
+ return "密码不能为空";
|
|
|
+ }
|
|
|
+ if (value.length < 6) {
|
|
|
+ return "密码长度至少6位";
|
|
|
+ }
|
|
|
+ if (!/[a-zA-Z]/.test(value)) {
|
|
|
+ return "密码必须包含字母";
|
|
|
+ }
|
|
|
+ if (!/\d/.test(value)) {
|
|
|
+ return "密码必须包含数字";
|
|
|
+ }
|
|
|
+ if (!/[~!@#$%^&*_+]/.test(value)) {
|
|
|
+ return "密码必须包含英文特殊符号(~!@#$%^&*_+)";
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ },
|
|
|
/** 重置密码按钮操作 */
|
|
|
handleResetPwd(row) {
|
|
|
this.$prompt('请输入"' + row.username + '"的新密码', "提示", {
|
|
|
confirmButtonText: "确定",
|
|
|
cancelButtonText: "取消",
|
|
|
+ inputValidator: this.validatePassword,
|
|
|
})
|
|
|
.then(({ value }) => {
|
|
|
resetUserPwd(row.id, value).then((response) => {
|