密码校验

main
mo 1 year ago
parent 93897b82c6
commit 6f5a90ce5d

@ -39,6 +39,17 @@ export default {
}); });
}, },
submit() { submit() {
var pwdRegex = new RegExp("(?=.*[0-9])(?=.*[a-zA-Z])");
if (this.passwords.length < 8 || this.passwords.length > 20) {
this.$modal.msgError("您的密码长度不符合!");
return false;
}
if (!pwdRegex.test(this.passwords)) {
this.$modal.msgError(
"您的密码复杂度太低(密码中必须包含字母、数字),请及时修改密码!"
);
return false;
}
const data = this.passwords; const data = this.passwords;
createPasswords({ passwordValue: data }).then((response) => { createPasswords({ passwordValue: data }).then((response) => {
this.$modal.msgSuccess("设置成功"); this.$modal.msgSuccess("设置成功");

Loading…
Cancel
Save