vbea 1 год назад
Родитель
Сommit
5e2aa30295

+ 2 - 1
Strides-Admin/src/settings.js

@@ -17,7 +17,8 @@ module.exports = {
   enableWebPos: true,
   enableTopup: false,
   enableEVCPID: true,
-  enableOCPIToken: false,
+  enableOCPIToken: false, //是否显示完整的OCPI Token(仅ChargEco为false)
+  enablePassword12: true, //是否启用高复杂度密码安全策略(仅ChargEco为true)
   /**
    * @type {string}
    * @description API url base service

+ 27 - 19
Strides-Admin/src/views/access/DialogDetail.vue

@@ -246,26 +246,34 @@ export default {
           trigger: "change",
           validator: (rule, value, callback) => {
             if (value) {
-              var strength = 0;
-              if (value.length >= 12) {
-                strength += 1;
-              }
-              if (/\d{1,}/.test(value)) {
-                strength += 1;
-              }
-              if (/[a-z]{1,}/.test(value)) {
-                strength += 1;
-              }
-              if (/[A-Z]{1,}/.test(value)) {
-                strength += 1;
-              }
-              if (/\W{1,}/.test(value)) {
-                strength += 1;
-              }
-              if (strength>=5) {
-                callback()
+              if (settings.enablePassword12) {
+                var strength = 0;
+                if (value.length >= 12) {
+                  strength += 1;
+                }
+                if (/\d{1,}/.test(value)) {
+                  strength += 1;
+                }
+                if (/[a-z]{1,}/.test(value)) {
+                  strength += 1;
+                }
+                if (/[A-Z]{1,}/.test(value)) {
+                  strength += 1;
+                }
+                if (/\W{1,}/.test(value)) {
+                  strength += 1;
+                }
+                if (strength>=5) {
+                  callback()
+                } else {
+                  callback("The password is not strength")
+                }
               } else {
-                callback("The password is not strength")
+                if (value.length < 6) {
+                  callback("Password needs to be more than 6 characters")
+                } else {
+                  callback()
+                }
               }
             } else if (!this.isEdit) {
               callback("Passwrod is required")

+ 16 - 5
Strides-Admin/src/views/login/login.vue

@@ -122,10 +122,22 @@ export default {
   name: 'Login',
   data() {
     const validatePassword = (rule, value, callback) => {
-      if (value.length < 6) {
-        callback(new Error('The password can not be less than 6 digits'))
+      if (value.length == 0) {
+        callback(new Error("Please type password"))
       } else {
-        callback()
+        if (settings.enablePassword12) {
+          if (value.length < 12) {
+            callback(new Error('The password can not be less than 12 characters'))
+          } else {
+            callback()
+          }
+        } else {
+          if (value.length < 6) {
+            callback(new Error('The password can not be less than 6 characters'))
+          } else {
+            callback()
+          }
+        }
       }
     }
     return {
@@ -150,8 +162,7 @@ export default {
         password: [{
           required: true,
           trigger: 'blur',
-          message: "Please type password"
-          //validator: validatePassword
+          validator: validatePassword
         }]
       },
       passwordType: 'password',