From 58aebf343084d71f0db27287c645c14400f8cb6d Mon Sep 17 00:00:00 2001
From: wl <173@qq.com>
Date: 星期二, 20 十二月 2022 17:44:04 +0800
Subject: [PATCH] fix:密码校验

---
 src/views/systemSetting/baseSetting/user/components/password/index.vue |   37 +++++++++++++++++--------------------
 1 files changed, 17 insertions(+), 20 deletions(-)

diff --git a/src/views/systemSetting/baseSetting/user/components/password/index.vue b/src/views/systemSetting/baseSetting/user/components/password/index.vue
index 2a7eb82..69322c5 100644
--- a/src/views/systemSetting/baseSetting/user/components/password/index.vue
+++ b/src/views/systemSetting/baseSetting/user/components/password/index.vue
@@ -3,15 +3,15 @@
         <el-form ref="pwd" label-width="140px" autoComplete="on" :model="user" :rules="passrules">
             <!-- 鍒濆瀵嗙爜 -->
             <el-form-item class="optionItem" label="鍒濆瀵嗙爜:" prop="password">
-                <el-input v-model="user.password" type="password" placeholder="璇峰~鍐欏垵濮嬪瘑鐮�"></el-input>
+                <el-input v-model="user.password" type="password" placeholder="璇峰~鍐欏垵濮嬪瘑鐮�"  show-password></el-input>
             </el-form-item>
             <!-- 鏂板瘑鐮� -->
             <el-form-item class="optionItem" label="鏂板瘑鐮�:" prop="newPwd">
-                <el-input v-model="user.newPwd" type="password" placeholder="璇峰~鍐欐柊瀵嗙爜"></el-input>
+                <el-input v-model="user.newPwd" type="password" placeholder="璇峰~鍐欐柊瀵嗙爜"  show-password></el-input>
             </el-form-item>
             <!-- 鏂板瘑鐮� -->
             <el-form-item class="optionItem" label="纭鏂板瘑鐮�:" prop="secondPwd">
-                <el-input v-model="user.secondPwd" type="password" placeholder="纭鎮ㄧ殑鏂板瘑鐮�"></el-input>
+                <el-input v-model="user.secondPwd" type="password" placeholder="纭鎮ㄧ殑鏂板瘑鐮�"  show-password></el-input>
             </el-form-item>
 
         </el-form>
@@ -32,24 +32,21 @@
             }
         }
         const checkNewPwd = (rule, value, callback) => {
-            if (!value) {
-                callback(new Error('鏂板瘑鐮佷笉鑳戒负绌�'))
-            } else if (value === this.user.password) {
-                callback(new Error('鏂板瘑鐮佷笉鑳藉拰鏃у瘑鐮佷竴鏍�'))
-            } else {
-                callback();
-            }
-        }
+          var rep =/^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])[a-zA-Z0-9]{8,16}$/;
+          if (!rep.test(value) ) {
+            callback(new Error("瀵嗙爜闀垮害8鍒�16浣嶄笖瀵嗙爜涓殑瀛楃蹇呴』鍖呭惈瀛楁瘝澶у啓鍜屽瓧姣嶅皬鍐欏拰蹇呴』鍖呭惈鏁板瓧锛屼笉鑳藉寘鍚┖鏍�"));
+          } else {
+            callback();
+          }
+    };
+        
         const checkSame = (rule, value, callback) => {
-            if (!value) {
-                callback(new Error('纭瀵嗙爜涓嶈兘涓虹┖'))
-            } else if (value !== this.user.newPwd) {
-                console.log(111);
-                callback(new Error('鎮ㄨ緭鍏ョ殑涓ゆ瀵嗙爜缁撴灉涓嶅悓'));
-            } else {
-
-                callback();
-            }
+            var rep =/^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])[a-zA-Z0-9]{8,16}$/;
+          if (!rep.test(value) ) {
+            callback(new Error("瀵嗙爜闀垮害8鍒�16浣嶄笖瀵嗙爜涓殑瀛楃蹇呴』鍖呭惈瀛楁瘝澶у啓鍜屽瓧姣嶅皬鍐欏拰蹇呴』鍖呭惈鏁板瓧锛屼笉鑳藉寘鍚┖鏍�"));
+          } else {
+            callback();
+          }
         }
         return {
             user: {

--
Gitblit v1.8.0