Browse Source

修改密码不能输入汉字

zhouna 4 years atrás
parent
commit
0f98c9f9ae
1 changed files with 8 additions and 1 deletions
  1. 8 1
      src/js/index.js

+ 8 - 1
src/js/index.js

@@ -140,8 +140,12 @@ function bindModalEvent(){
     }
   });
   $("#newWord").off("input").on("input",function(){
-      const text = $(this).val();
+      let text = $(this).val();
       const checker = $(".alertModal .psd-checkbox");
+      if(/[\u4e00-\u9fa5]/g.test(text)){
+          $(this).val(text.replace(/[\u4e00-\u9fa5]/g,''));
+      }
+      text = $(this).val();
       $(".newword.warning,.sureword.warning").hide();
       if(text.trim()){    //显示密码验证标签
         if(checker.length){
@@ -170,6 +174,9 @@ function bindModalEvent(){
     $("#sureWord").off("input").on("input",function(){
         const text = $(this).val();
         $(".sureword.warning").hide();
+        if(/[\u4e00-\u9fa5]/g.test(text)){
+            $(this).val(text.replace(/[\u4e00-\u9fa5]/g,''));
+        }
         if(text.trim()){
             let psdsOk=verifyPsdPart();
             const psdOk = verifyPsd(text);