diff --git a/src/views/setting/passwords/index.vue b/src/views/setting/passwords/index.vue index 95809d4d..bdb6eae0 100644 --- a/src/views/setting/passwords/index.vue +++ b/src/views/setting/passwords/index.vue @@ -39,6 +39,17 @@ export default { }); }, 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; createPasswords({ passwordValue: data }).then((response) => { this.$modal.msgSuccess("设置成功");