密码策略修改

This commit is contained in:
gongjiale 2024-12-17 21:13:05 +08:00
parent c7c021931a
commit 140417fcba
3 changed files with 38 additions and 15 deletions

View File

@ -108,12 +108,12 @@ public class OutSideServiceImpl implements OutSideService {
SensorData sensorData = new SensorData(); SensorData sensorData = new SensorData();
sensorData.setSn(node.get("equipmentUId").asText()); sensorData.setSn(node.get("equipmentUId").asText());
sensorData.setDs(node.get("vocRtd").asText()); sensorData.setDs(node.get("vocRtd").asText());
sensorData.setDw(getUnitDescription(5)); sensorData.setDw("mg/m3");
// "vocTime":"2024-10-30T07:19:20.000+0000" 转为 yyyy-MM-dd HH:mm:ss // "vocTime":"2024-10-30T07:19:20.000+0000" 转为 yyyy-MM-dd HH:mm:ss
String reportTime = node.get("vocTime").asText().replace("T", " ").substring(0, 19); String reportTime = node.get("vocTime").asText().replace("T", " ").substring(0, 19);
sensorData.setReportTime(reportTime); sensorData.setReportTime(reportTime);
sensorData.setZt(node.get("vocRtd").asInt() > 5 ? "一级报警" : "正常"); sensorData.setZt(node.get("vocRtd").asInt() > 4 ? "一级报警" : "正常");
return sensorData; return sensorData;
} }

View File

@ -95,7 +95,7 @@ export default {
], ],
password: [ password: [
{ required: true, trigger: "blur", message: "请输入您的密码" }, { required: true, trigger: "blur", message: "请输入您的密码" },
{ min: 5, max: 20, message: "用户密码长度必须介于 5 和 20 之间", trigger: "blur" }, { min: 5, max: 20, message: "用户密码长度必须介于 10 和 20 之间", trigger: "blur" },
{ pattern: /^[^<>"'|\\]+$/, message: "不能包含非法字符:< > \" ' \\\ |", trigger: "blur" } { pattern: /^[^<>"'|\\]+$/, message: "不能包含非法字符:< > \" ' \\\ |", trigger: "blur" }
], ],
confirmPassword: [ confirmPassword: [

View File

@ -374,7 +374,22 @@ export default {
dicts: ['sys_normal_disable', 'sys_user_sex'], dicts: ['sys_normal_disable', 'sys_user_sex'],
components: { Treeselect }, components: { Treeselect },
data() { data() {
const equalToPassword1 = (rule, value, callback) => {
let password = this.form.password
let hasUpperCase = /[A-Z]/.test(password);
let hasLowerCase = /[a-z]/.test(password);
let hasNumber = /[0-9]/.test(password);
let hasSpecialCharacter = /[!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]/.test(password);
if (!hasUpperCase || !hasLowerCase || !hasNumber || !hasSpecialCharacter) {
callback(new Error("密码10位以上请包含大小写、特殊字符以及数字"));
}
else {
callback();
}
};
return { return {
// //
loading: true, loading: true,
// //
@ -455,8 +470,9 @@ export default {
{ required: true, message: "用户昵称不能为空", trigger: "blur" } { required: true, message: "用户昵称不能为空", trigger: "blur" }
], ],
password: [ password: [
{ required: true, message: "用户密码不能为空", trigger: "blur" }, { required: true, validator: equalToPassword1, trigger: "blur" },
{ min: 5, max: 20, message: '用户密码长度必须介于 5 和 20 之间', trigger: 'blur' }, // { required: true, message: "", trigger: "blur" },
{ min: 10, max: 20, message: '用户密码长度必须介于 10 和 20 之间', trigger: 'blur' },
{ pattern: /^[^<>"'|\\]+$/, message: "不能包含非法字符:< > \" ' \\\ |", trigger: "blur" } { pattern: /^[^<>"'|\\]+$/, message: "不能包含非法字符:< > \" ' \\\ |", trigger: "blur" }
], ],
email: [ email: [
@ -614,18 +630,25 @@ export default {
confirmButtonText: "确定", confirmButtonText: "确定",
cancelButtonText: "取消", cancelButtonText: "取消",
closeOnClickModal: false, closeOnClickModal: false,
inputPattern: /^.{5,20}$/, inputPattern: /^.{10,20}$/,
inputErrorMessage: "用户密码长度必须介于 5 和 20 之间", inputErrorMessage: "密码长度10-20位包含大小写、数字以及特殊字符"
inputValidator: (value) => {
if (/<|>|"|'|\||\\/.test(value)) {
return "不能包含非法字符:< > \" ' \\\ |"
}
},
}).then(({ value }) => { }).then(({ value }) => {
resetUserPwd(row.userId, value).then(response => { let password = value
this.$modal.msgSuccess("修改成功,新密码是:" + value); let hasUpperCase = /[A-Z]/.test(password);
let hasLowerCase = /[a-z]/.test(password);
let hasNumber = /[0-9]/.test(password);
let hasSpecialCharacter = /[!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]/.test(password);
if (!hasUpperCase || !hasLowerCase || !hasNumber || !hasSpecialCharacter) {
this.$message.error("密码不符合要求密码长度10-20位包含大小写、数字以及特殊字符");
} else {
let values =encrypt(value )
resetUserPwd(row.userId, values).then(response => {
debugger
this.$modal.msgSuccess("密码修改成功!");
}); });
}).catch(() => {}); }
}).catch(() => { });
}, },
/** 分配角色操作 */ /** 分配角色操作 */
handleAuthRole: function(row) { handleAuthRole: function(row) {