gcj 3 gadi atpakaļ
vecāks
revīzija
43e0e63dc6
1 mainītis faili ar 8 papildinājumiem un 16 dzēšanām
  1. 8 16
      src/components/common/Modifypassword.vue

+ 8 - 16
src/components/common/Modifypassword.vue

@@ -158,12 +158,9 @@ export default {
           if (this.ruleForm.Twopassword !== "") {
             this.$refs.ruleForm.validateField("Twopassword");
           }
-
-          if (
-            !/[A-Z]/.test(value) ||
-            !/[a-z]/.test(value) ||
-            !/[0-9]/.test(value)
-          ) {
+          let reg = /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])[a-zA-Z\d]{6,20}$/;
+          let bool = reg.test(value);
+          if (!bool) {
             // "密码必须是大写字母、小写字母和数字的组合。"
             callback(new Error(_this.$t("Key489")));
           }
@@ -250,16 +247,11 @@ export default {
       }
     },
     // 验证密码
-    changePassword() {
-      if (this.ruleForm.password) {
-        let reg = /^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d]{8,12}$/;
-        let result = reg.test(this.ruleForm.password);
-        if (result) {
-          this.passwordError = false;
-        } else {
-          this.passwordError = true;
-        }
-      }
+    changePassword(password) {
+      let reg = /^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d]{8,12}$/;
+      let bool = reg.test(password);
+
+      return bool;
     },
     // 验证第二次密码是否一样
     Changetowpassword() {