andre 4 лет назад
Родитель
Сommit
07c20812c5
1 измененных файлов с 69 добавлено и 71 удалено
  1. 69 71
      checkconfigureproduct.tpl

+ 69 - 71
checkconfigureproduct.tpl

@@ -1,73 +1,4 @@
 <script>
 <script>
-    function checkPW(pw) {
-        var pwlengthOK = false;
-        var numericOK = false;
-        var symbolsOK = false;
-        var upperOK = false;
-        console.log(pw);
-        var pwlength = (pw.length);
-        if (pwlength > 7) {
-            pwlengthOK = true;
-            $("#hintLength").text('');
-        } else {
-            pwlengthOK = false;
-            $("#hintLength").text('Benutzen Sie mindestens 8 Zeichen');
-        }
-        var numeric = pw.replace(/[0-9]/g, "");
-        var numnumeric = (pw.length - numeric.length);
-        if (numnumeric > 0) {
-            numericOK = true;
-            $("#hintNumeric").text('');
-        } else {
-            numericOK = false;
-            $("#hintNumeric").text('Benutzen Sie mindestens eine Zahl');
-        }
-        var symbols = pw.replace(/\W/g, "");
-        var numsymbols = (pw.length - symbols.length);
-        if (numsymbols > 0) {
-            symbolsOK = true;
-            $("#hintSymbols").text('');
-        } else {
-            symbolsOK = false;
-            $("#hintSymbols").text('Benutzen Sie auch mindestens ein Symbol oder Sonderzeichen (# $ ! % & + - etc...)');
-        }
-        var upper = pw.replace(/[A-Z]/g, "");
-        var numupper = (pw.length - upper.length);
-        var lower = pw.replace(/[a-z]/g, "");
-        var numlower = (pw.length - lower.length);
-        if ((numupper > 0) && (numlower > 0)) {
-            upperlowerOK = true;
-            $("#hintUpperLower").text('');
-        } else {
-            upperlowerOK = false;
-            $("#hintUpperLower").text('Benutzen Sie Groß- und Kleinschreibung');
-        }
-        $(customFields[4]).removeClass('has-error has-warning has-success');
-        if (pwlengthOK && numericOK && symbolsOK && upperlowerOK) {
-            $(customFields[5]).prop("disabled",false);
-            $(customFields[4]).addClass('has-success');
-            $(customFields[4]).css('background-color', '#0f03');;
-            $("#hintHead").text('');
-        } else {
-            $(customFields[5]).prop("disabled",true);
-            $(customFields[4]).addClass('has-error');
-            $(customFields[4]).css('background-color', '#f003');;
-            $("#hintHead").text('Tipps für ein gutes Passwort');
-        }
-    };
-    function checkPWRepeat(customFields) {
-        if ($(customFields[5]).val() == $(customFields[4]).val()) {
-            $("#btnCompleteProductConfig").prop("disabled",false);
-            $(customFields[5]).addClass('has-success');
-            $(customFields[5]).css('background-color', '#0f03');;
-            $("#hintHead").text('');
-        } else {
-            $("#btnCompleteProductConfig").prop("disabled",true);
-            $(customFields[5]).addClass('has-error');
-            $(customFields[5]).css('background-color', '#f003');;
-            $("#hintHead").text('Passworte stimmen nicht überein!');
-        }
-    };
     function checkMailAddress ( mailname, maildomain, pid) {
     function checkMailAddress ( mailname, maildomain, pid) {
         var xhttp = new XMLHttpRequest();
         var xhttp = new XMLHttpRequest();
         var success = false;
         var success = false;
@@ -123,7 +54,74 @@
             $("#hintSymbols").text('Benutzen Sie auch mindestens eines der folgenden Symbole (# $ ! % + - etc...)');
             $("#hintSymbols").text('Benutzen Sie auch mindestens eines der folgenden Symbole (# $ ! % + - etc...)');
             $("#hintUpperLower").text('Benutzen Sie Groß- und Kleinschreibung');
             $("#hintUpperLower").text('Benutzen Sie Groß- und Kleinschreibung');
         });
         });
-        $(customFields[4]).keyup(console.log($(customFields[4]).val()));
-        $(customFields[5]).keyup(checkPWRepeat(customFields));
+        $(customFields[4]).keyup(function () {
+            var pwlengthOK = false;
+            var numericOK = false;
+            var symbolsOK = false;
+            var upperOK = false;
+            var pw = $(customFields[4]).val();
+            var pwlength = (pw.length);
+            if (pwlength > 7) {
+                pwlengthOK = true;
+                $("#hintLength").text('');
+            } else {
+                pwlengthOK = false;
+                $("#hintLength").text('Benutzen Sie mindestens 8 Zeichen');
+            }
+            var numeric = pw.replace(/[0-9]/g, "");
+            var numnumeric = (pw.length - numeric.length);
+            if (numnumeric > 0) {
+                numericOK = true;
+                $("#hintNumeric").text('');
+            } else {
+                numericOK = false;
+                $("#hintNumeric").text('Benutzen Sie mindestens eine Zahl');
+            }
+            var symbols = pw.replace(/\W/g, "");
+            var numsymbols = (pw.length - symbols.length);
+            if (numsymbols > 0) {
+                symbolsOK = true;
+                $("#hintSymbols").text('');
+            } else {
+                symbolsOK = false;
+                $("#hintSymbols").text('Benutzen Sie auch mindestens ein Symbol oder Sonderzeichen (# $ ! % & + - etc...)');
+            }
+            var upper = pw.replace(/[A-Z]/g, "");
+            var numupper = (pw.length - upper.length);
+            var lower = pw.replace(/[a-z]/g, "");
+            var numlower = (pw.length - lower.length);
+            if ((numupper > 0) && (numlower > 0)) {
+                upperlowerOK = true;
+                $("#hintUpperLower").text('');
+            } else {
+                upperlowerOK = false;
+                $("#hintUpperLower").text('Benutzen Sie Groß- und Kleinschreibung');
+            }
+            $(customFields[4]).removeClass('has-error has-warning has-success');
+            if (pwlengthOK && numericOK && symbolsOK && upperlowerOK) {
+                $(customFields[5]).prop("disabled",false);
+                $(customFields[4]).addClass('has-success');
+                $(customFields[4]).css('background-color', '#0f03');;
+                $("#hintHead").text('');
+            } else {
+                $(customFields[5]).prop("disabled",true);
+                $(customFields[4]).addClass('has-error');
+                $(customFields[4]).css('background-color', '#f003');;
+                $("#hintHead").text('Tipps für ein gutes Passwort');
+            }
+        });
+        $(customFields[5]).keyup(function () {
+            if ($(customFields[5]).val() == $(customFields[4]).val()) {
+                $("#btnCompleteProductConfig").prop("disabled",false);
+                $(customFields[5]).addClass('has-success');
+                $(customFields[5]).css('background-color', '#0f03');;
+                $("#hintHead").text('');
+            } else {
+                $("#btnCompleteProductConfig").prop("disabled",true);
+                $(customFields[5]).addClass('has-error');
+                $(customFields[5]).css('background-color', '#f003');;
+                $("#hintHead").text('Passworte stimmen nicht überein!');
+            }
+        });
     });
     });
 </script>
 </script>