andre 4 лет назад
Родитель
Сommit
07220084ef
1 измененных файлов с 39 добавлено и 0 удалено
  1. 39 0
      templates/clientarea.tpl

+ 39 - 0
templates/clientarea.tpl

@@ -431,6 +431,45 @@
   </div>
   </div>
   <div class="tab-pane fade in" id="tabChangepw">
+  <script>
+jQuery(document).ready(function(){
+    $("#btnCompleteProductConfig").prop("disabled",true);
+    jQuery(":password").keyup(function () {
+        var pwStrengthErrorThreshold = 50;
+        var pwStrengthWarningThreshold = 75;
+
+        var $newPassword1 = jQuery(":password");
+        var pw = jQuery(":password").val();
+        var pwlength = (pw.length);
+        if (pwlength > 5) pwlength = 5;
+        var numnumeric = pw.replace(/[0-9]/g, "");
+        var numeric = (pw.length - numnumeric.length);
+        if (numeric > 3) numeric = 3;
+        var symbols = pw.replace(/\W/g, "");
+        var numsymbols = (pw.length - symbols.length);
+        if (numsymbols > 3) numsymbols = 3;
+        var numupper = pw.replace(/[A-Z]/g, "");
+        var upper = (pw.length - numupper.length);
+        if (upper > 3) upper = 3;
+        var pwstrength = ((pwlength * 10) - 20) + (numeric * 10) + (numsymbols * 15) + (upper * 10);
+        if (pwstrength < 0) pwstrength = 0;
+        if (pwstrength > 100) pwstrength = 100;
+
+        $newPassword1.removeClass('has-error has-warning has-success');
+        if (pwstrength < pwStrengthErrorThreshold) {
+            $newPassword1.addClass('has-error');
+            $newPassword1.css('background-color', '#f003');;
+        } else if (pwstrength < pwStrengthWarningThreshold) {
+            $newPassword1.addClass('has-warning');
+            $newPassword1.css('background-color', '#ff03');;
+        } else {
+            $newPassword1.addClass('has-success');
+            $newPassword1.css('background-color', '#0f03');;
+            $("#btnCompleteProductConfig").removeProp("disabled");
+        }
+    });
+});
+</script>
   <div class="section">
     <div class="section-header">
       <h3>{$LANG.serverchangepassword}</h3>