diff --git a/static/main.js b/static/main.js
index e69de29..e381ac6 100644
--- a/static/main.js
+++ b/static/main.js
@@ -0,0 +1,273 @@
+// Example starter JavaScript for disabling form submissions if there are invalid fields
+(function () {
+    'use strict';
+    window.addEventListener('load', function () {
+        // Fetch all the forms we want to apply custom Bootstrap validation styles to
+        var forms = document.getElementsByClassName('needs-validation');
+        // Loop over them and prevent submission
+        var validation = Array.prototype.filter.call(forms, function (form) {
+            form.addEventListener('submit', function (event) {
+                if (form.checkValidity() === false) {
+                    event.preventDefault();
+                    event.stopPropagation();
+                }
+                form.classList.add('was-validated');
+            }, false);
+        });
+    }, false);
+})();
+
+
+function check_password_match() {
+    pass = $("#pw1").val();
+    pass2 = $("#pw2").val();
+
+    if (pass2.length > 0) {
+        $("#pwconfirm")[0].classList.add('was-validated')
+        if (pass != pass2) {
+            $("#pw2")[0].setCustomValidity("Passwords do not match");
+        } else {
+            $("#pw2")[0].setCustomValidity(""); // is valid
+        }
+    } else {
+        $("#pwconfirm")[0].classList.remove('was-validated')
+    }
+    passUpdated();
+}
+
+TOO_SHORT = 'Password too short, still %% characters needed';
+TOO_LONG = 'Password too long, please remove %% characters';
+INVALID_CHARS = 'Password contains invalid characters';
+QUAL_NONE = 'Password is very weak'
+QUAL_LOW = 'Password is weak';
+QUAL_MEDIUM = 'Password is average'
+QUAL_GOOD = 'Password is good';
+QUAL_STRONG = 'Password is strong';
+REP_OK = 'Repetition ok';
+REP_NE = 'Passwords not identical';
+PWNED = 'Password found in public password list';
+
+String.prototype.strReverse = function () {
+    var newstring = '';
+    for (var s = 0; s < this.length; s++)
+        newstring = this.charAt(s) + newstring;
+    return newstring;
+};
+
+function isPasswordPwned(pass, callback) {
+    const sha1Hash = CryptoJS.enc.Hex.stringify(CryptoJS.SHA1(pass)).toUpperCase();
+    const passwordChunk1 = sha1Hash.substring(0, 5);
+    const passwordChunk2 = sha1Hash.substring(5);
+    $.get('https://api.pwnedpasswords.com/range/' + passwordChunk1).done(function (data, status) {
+        var isPwned = false;
+        if (status == "success") {
+            if (data && data.length) {
+                const chunks = data.split('\r\n');
+                const matches = chunks.filter(s => s.includes(passwordChunk2));
+
+                if (matches.length) {
+                    isPwned = true
+                }
+            }
+            callback(isPwned)
+        }
+    });
+}
+
+//var checkTimer;
+
+function passUpdated() {
+    var nScore = 0;
+    var message = '';
+
+    var pass = $('#pw1').val();
+    var pass2 = $('#pw2').val();
+
+    //clearTimeout(checkTimer);
+
+    try {
+        if (!pass)
+            throw '';
+
+        if (pass.match(/[^a-zA-Z0-9!@#$%()_+=:;",.?/-]/))
+            throw INVALID_CHARS;
+
+        var nLength = pass.length;
+        if (nLength < 8)
+            throw TOO_SHORT.replace('%%', 8 - nLength);
+        if (nLength > 20)
+            throw TOO_LONG.replace('%%', nLength - 20);
+
+        nScore = 4 * nLength;
+
+        // check for upper-/lowercase, numeric and special chars pattern matches
+        var nAlphaUC = 0, nAlphaLC = 0, nNumber = 0, nSpecial = 0;
+        var nMidChar = 0, nRepChar = 0, nRepInc = 0;
+        var nConsecAlphaUC = 0, nConsecAlphaLC = 0, nConsecNumber = 0;
+        var nTmpAlphaUC = '', nTmpAlphaLC = '', nTmpNumber = '';
+        for (var i = 0; i < nLength; i++) {
+            if (pass[i].match(/[A-Z]/g)) {   // uppercase characters
+                if (nTmpAlphaUC !== '' && (nTmpAlphaUC + 1) == i) {
+                    nConsecAlphaUC++;
+                }
+                nTmpAlphaUC = i;
+                nAlphaUC++;
+            } else if (pass[i].match(/[a-z]/g)) {   // lowercase characters
+                if (nTmpAlphaLC !== '' && (nTmpAlphaLC + 1) == i) {
+                    nConsecAlphaLC++;
+                }
+                nTmpAlphaLC = i;
+                nAlphaLC++;
+            } else if (pass[i].match(/[0-9]/g)) {   // numbers
+                if (i > 0 && i < (nLength - 1)) {
+                    nMidChar++;
+                }
+                if (nTmpNumber !== '' && (nTmpNumber + 1) == i) {
+                    nConsecNumber++;
+                }
+                nTmpNumber = i;
+                nNumber++;
+            } else {   // special characters
+                if (i > 0 && i < (nLength - 1)) {
+                    nMidChar++;
+                }
+                nSpecial++;
+            }
+
+            // check for repeated characters
+            var bCharExists = false;
+            for (var j = 0; j < nLength; j++) {
+                if (pass[i] == pass[j] && i != j) {
+                    bCharExists = true;
+                    nRepInc += Math.abs(nLength / (j - i));
+                }
+            }
+            if (bCharExists) {
+                nRepChar++;
+                var nUnqChar = nLength - nRepChar;
+                nRepInc = (nUnqChar) ? Math.ceil(nRepInc / nUnqChar) : Math.ceil(nRepInc);
+            }
+        }
+
+        // check for sequential alpha string patterns (forward and reverse)
+        var sAlphas = "abcdefghijklmnopqrstuvwxyz";
+        var nSeqAlpha = 0;
+        for (var i = 0; i < 23; i++) {
+            var sFwd = sAlphas.substring(i, i + 3);
+            var sRev = sFwd.strReverse();
+            if (pass.toLowerCase().indexOf(sFwd) != -1
+                || pass.toLowerCase().indexOf(sRev) != -1)
+                nSeqAlpha++;
+        }
+
+        // check for sequential numeric string patterns (forward and reverse)
+        var sNumerics = "01234567890";
+        var nSeqNumber = 0;
+        for (var i = 0; i < 8; i++) {
+            var sFwd = sNumerics.substring(i, i + 3);
+            var sRev = sFwd.strReverse();
+            if (pass.toLowerCase().indexOf(sFwd) != -1
+                || pass.toLowerCase().indexOf(sRev) != -1)
+                nSeqNumber++;
+        }
+
+        // general point assignment
+        if (nAlphaUC > 0 && nAlphaUC < nLength)   // uppercase characters
+            nScore += 2 * (nLength - nAlphaUC);
+        if (nAlphaLC > 0 && nAlphaLC < nLength)   // lowercase characters
+            nScore += 2 * (nLength - nAlphaLC);
+        if (nNumber > 0 && nNumber < nLength)   // numbers
+            nScore += 2 * nNumber;
+        if (nSpecial > 0)   // special characters
+            nScore += 4 * nSpecial;
+        if (nMidChar > 0)   // mid numbers/special characters
+            nScore += 2 * nMidChar;
+
+        // point deductions for poor practices
+        if ((nAlphaLC > 0 || nAlphaUC > 0)
+            && nSpecial === 0 && nNumber === 0)   // characters only
+            nScore -= nLength;
+        if (nAlphaLC === 0 && nAlphaUC === 0
+            && nSpecial === 0 && nNumber > 0)   // numbers only
+            nScore -= nLength;
+        if (nRepChar > 0)   // same character exists more than once
+            nScore -= nRepInc;
+        if (nConsecAlphaUC > 0)   // consecutive uppercase letters exist
+            nScore -= 2 * nConsecAlphaUC;
+        if (nConsecAlphaLC > 0)   // consecutive lowercase letters exist
+            nScore -= 2 * nConsecAlphaLC;
+        if (nConsecNumber > 0)   // consecutive numbers exist
+            nScore -= 2 * nConsecNumber;
+        if (nSeqAlpha > 0)   // sequential alpha strings exist (3 chars or more)
+            nScore -= 3 * nSeqAlpha;
+        if (nSeqNumber > 0)   // sequential numeric strings exist (3 chars or more)
+            nScore -= 3 * nSeqNumber;
+
+        // determine if mandatory requirements have been met
+        var arrChars = [nAlphaUC, nAlphaLC, nNumber, nSpecial];
+        var nReqChar = 0;
+        for (var i = 0; i < arrChars.length; i++) {
+            if (arrChars[i]) {
+                nReqChar++;
+            }
+        }
+        if (nReqChar >= arrChars.length)
+            nScore += 2 * nReqChar;
+        else if (nReqChar < arrChars.length - 1)
+            nScore -= 2 * nReqChar;
+
+        // limit points to 3..100
+        nScore = Math.max(3, Math.min(nScore, 100));
+
+        // set message according to points
+        if (nScore >= 80)
+            message = QUAL_STRONG;
+        else if (nScore >= 60)
+            message = QUAL_GOOD;
+        else if (nScore >= 40)
+            message = QUAL_MEDIUM;
+        else if (nScore >= 10)
+            message = QUAL_LOW;
+        else
+            message = QUAL_NONE;
+    } catch (error) {
+        nScore = 3;
+        message = error;
+    }
+    /*
+                if (pass.length > 0 && pass2.length > 0) {
+                    message+=' / ';
+                    message+=(pass == pass2) ? REP_OK : REP_NE;
+                }
+    */
+    $('#pwqinfo').val(message);
+
+    var progress = $('#pwqbar');
+    progress.width(nScore + '%');
+    progress.attr('aria-valuenow', nScore);
+    if (nScore >= 60)
+        progress.removeClass('bg-danger bg-warning').addClass('bg-success');
+    else if (nScore >= 40)
+        progress.removeClass('bg-danger bg-success').addClass('bg-warning');
+    else
+        progress.removeClass('bg-warning bg-success').addClass('bg-danger');
+
+    if (nScore >= 40) {
+        $("#password-div")[0].classList.add('was-validated');
+        $('#btn_change').prop('disabled', pass !== pass2);
+        $("#pw1")[0].setCustomValidity("");
+        isPasswordPwned(pass, function (isPwned) {
+            if (isPwned) {
+                $('#pwqinfo').val(PWNED);
+                progress.removeClass().addClass('low');
+                progress.val(3);
+                $("#pw1")[0].setCustomValidity("Password is pwned");
+            }
+        });
+    } else {
+        $("#password-div")[0].classList.add('was-validated');
+        $('#btn_change').prop('disabled', 1);
+        $("#pw1")[0].setCustomValidity("Password is to week");
+    }
+
+}
diff --git a/templates/bottom.htm b/templates/bottom.htm
index 90e40b5..2a5f068 100644
--- a/templates/bottom.htm
+++ b/templates/bottom.htm
@@ -1,6 +1,6 @@
     <!-- Optional JavaScript -->
     <!-- jQuery first, then Popper.js, then Bootstrap JS -->
-    <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
+    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.3/jquery.min.js" integrity="sha512-STof4xm1wgkfm7heWqFJVn58Hm3EtS31XFaagaa8VMReCXAkQnJZ+jEy8PCC/iT18dFy95WcExNHFTqLyp72eQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
     <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
     <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
 
diff --git a/templates/header.htm b/templates/header.htm
index 8c8411f..256613e 100644
--- a/templates/header.htm
+++ b/templates/header.htm
@@ -9,9 +9,12 @@
     <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
     <link href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap-glyphicons.css" rel="stylesheet">
     <link rel="stylesheet" href="<?php echo $BASE_URL?>/static/main.css" >
-    <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
+    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.3/jquery.min.js" integrity="sha512-STof4xm1wgkfm7heWqFJVn58Hm3EtS31XFaagaa8VMReCXAkQnJZ+jEy8PCC/iT18dFy95WcExNHFTqLyp72eQ==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
     <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
     <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
+    <script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/4.1.1/core.min.js" integrity="sha512-t8vdA86yKUE154D1VlNn78JbDkjv3HxdK/0MJDMBUXUjshuzRgET0ERp/0MAgYS+8YD9YmFwnz6+FWLz1gRZaw==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
+    <script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/4.1.1/enc-hex.min.js" integrity="sha512-jDU0YCduSP8z0cvjfPFm7/zN/viOcmNWlq0GUIcjVhuv4WoKcMppghamg4aeuBtJaA0wjtYfxwQjPpVuYGEsBA==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
+    <script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/4.1.1/sha1.min.js" integrity="sha512-NHw1e1pc4RtmcynK88fHt8lpuetTUC0frnLBH6OrjmKGNnwY4nAnNBMjez4DRr9G1b+NtufOXLsF+apmkRCEIw==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
     <script src="<?php echo $BASE_URL?>/static/main.js"></script>
 
     <style>
diff --git a/templates/register.htm b/templates/register.htm
index 4f116d2..624a0cf 100644
--- a/templates/register.htm
+++ b/templates/register.htm
@@ -58,17 +58,18 @@
     </div>
 
     <!-- Password input -->
-    <div class="form-outline mb-3">
+    <div id="password-div" class="form-outline mb-3">
         <label class="form-label font-weight-bold" for="pw1">Password*</label>
-        <input pattern="[^\s]{<?php echo $VAL_USER->min_password.','.$VAL_USER->max_password;?>}" required
-            title="At least 8 not whitespace characters" name="password" type="password" id="pw1"
-            class="form-control <?php if(isset($error) && $error && !isset($_POST['password'])){echo 'border-danger';}?>"
+        <input required
+            title="Combination of upper and lowercase letters, numbers, punctuation, and special symbols" name="password" type="password" id="pw1"
+            class="form-control"
             placeholder="********"  oninput="check_password_match()"
             value="<?php echo isset($_POST['password']) ? htmlspecialchars($_POST['password']) : '' ?>" />
         <div class="progress mt-2">
             <div class="progress-bar bg-danger" role="progressbar" id="pwqbar" aria-valuenow="0" aria-valuemin="0"
                 aria-valuemax="100"></div>
         </div>
+        <input class="form-control" type="text" name="pwqinfo" id="pwqinfo" readonly>
     </div>
     <!--
     <div class="form-group">
@@ -80,11 +81,11 @@
         </div>
     </div>
     -->
-    <!-- Password input -->
+    <!-- Password confirmation input -->
     <div id="pwconfirm" class="form-outline mb-3">
         <label class="form-label font-weight-bold" for="pw2">Confirm your Password*</label>
-        <input pattern="[^\s]{<?php echo $VAL_USER->min_password.','.$VAL_USER->max_password;?>}" required
-            title="At least 8 not whitespace characters" name="password_confirm" type="password" id="pw2"
+        <input  required
+            name="password_confirm" type="password" id="pw2"
             class="form-control <?php if(isset($error) && $error && !isset($_POST['password_confirm'])){echo 'border-danger';}?>"
             placeholder="********" oninput="check_password_match()" />
             <div class="invalid-feedback">
@@ -147,260 +148,3 @@
 
 </form>
 </div>
-
-<script>
-    // Example starter JavaScript for disabling form submissions if there are invalid fields
-    (function () {
-        'use strict';
-        window.addEventListener('load', function () {
-            // Fetch all the forms we want to apply custom Bootstrap validation styles to
-            var forms = document.getElementsByClassName('needs-validation');
-            // Loop over them and prevent submission
-            var validation = Array.prototype.filter.call(forms, function (form) {
-                form.addEventListener('submit', function (event) {
-                    if (form.checkValidity() === false) {
-                        event.preventDefault();
-                        event.stopPropagation();
-                    }
-                    form.classList.add('was-validated');
-                }, false);
-            });
-        }, false);
-    })();
-
-    function check_password_match() {
-            pass =  $("#pw1").val();
-            pass2 =  $("#pw2").val();
-
-        if (pass2.length > 0) {
-            $("#pwconfirm")[0].classList.add('was-validated')
-            if (pass != pass2) {
-                $("#pw2")[0].setCustomValidity("Passwords do not match");
-            } else {
-                $("#pw2")[0].setCustomValidity(""); // is valid
-            }
-        } else {
-            $("#pwconfirm")[0].classList.remove('was-validated')
-        }
-        passUpdated();
-     }
-
-        TOO_SHORT      ='Password too short, still %% characters needed';
-        TOO_LONG       ='Password too long, please remove %% characters';
-        INVALID_CHARS  ='Password contains invalid characters';
-        QUAL_NONE      ='Password is very weak'
-        QUAL_LOW       ='Password is weak';
-        QUAL_MEDIUM    ='Password is average'
-        QUAL_GOOD      ='Password is good';
-        QUAL_STRONG    ='Password is strong';
-        REP_OK         ='Repetition ok';
-        REP_NE         ='Passwords not identical';
-        PWNED          ='Password found in public password list';
-
-        String.prototype.strReverse=function() {
-            var newstring='';
-            for (var s=0; s < this.length; s++)
-                newstring=this.charAt(s)+newstring;
-            return newstring;
-        };
-
-        //var checkTimer;
-
-        function passUpdated() {
-            var nScore=0;
-            var message='';
-
-            var pass=$('#pw1').val();
-            var pass2=$('#pw2').val();
-
-            //clearTimeout(checkTimer);
-
-            try {
-                if (!pass)
-                    throw '';
-
-                if (pass.match(/[^a-zA-Z0-9!@#$%()_+=:;",.?/-]/))
-                    throw INVALID_CHARS;
-
-                var nLength=pass.length;
-                if (nLength < 8)
-                    throw TOO_SHORT.replace('%%', 8-nLength);
-                if (nLength > 20)
-                    throw TOO_LONG.replace('%%', nLength-20);
-
-                nScore=4*nLength;
-
-                // check for upper-/lowercase, numeric and special chars pattern matches
-                var nAlphaUC=0, nAlphaLC=0, nNumber=0, nSpecial=0;
-                var nMidChar=0, nRepChar=0, nRepInc=0;
-                var nConsecAlphaUC=0, nConsecAlphaLC=0, nConsecNumber=0;
-                var nTmpAlphaUC='', nTmpAlphaLC='', nTmpNumber='';
-                for (var i=0; i < nLength; i++) {
-                    if (pass[i].match(/[A-Z]/g)) {   // uppercase characters
-                        if (nTmpAlphaUC !== '' && (nTmpAlphaUC+1) == i) {
-                            nConsecAlphaUC++;
-                        }
-                        nTmpAlphaUC=i;
-                        nAlphaUC++;
-                    } else if (pass[i].match(/[a-z]/g)) {   // lowercase characters
-                        if (nTmpAlphaLC !== '' && (nTmpAlphaLC+1) == i) {
-                            nConsecAlphaLC++;
-                        }
-                        nTmpAlphaLC=i;
-                        nAlphaLC++;
-                    } else if (pass[i].match(/[0-9]/g)) {   // numbers
-                        if (i > 0 && i < (nLength-1)) {
-                            nMidChar++;
-                        }
-                        if (nTmpNumber !== '' && (nTmpNumber+1) == i) {
-                            nConsecNumber++;
-                        }
-                        nTmpNumber=i;
-                        nNumber++;
-                    } else {   // special characters
-                        if (i > 0 && i < (nLength-1)) {
-                            nMidChar++;
-                        }
-                        nSpecial++;
-                    }
-
-                    // check for repeated characters
-                    var bCharExists=false;
-                    for (var j=0; j < nLength; j++) {
-                        if (pass[i] == pass[j] && i != j) {
-                            bCharExists=true;
-                            nRepInc+=Math.abs(nLength/(j-i));
-                        }
-                    }
-                    if (bCharExists) {
-                        nRepChar++;
-                        var nUnqChar=nLength-nRepChar;
-                        nRepInc=(nUnqChar) ? Math.ceil(nRepInc/nUnqChar) : Math.ceil(nRepInc);
-                    }
-                }
-
-                // check for sequential alpha string patterns (forward and reverse)
-                var sAlphas="abcdefghijklmnopqrstuvwxyz";
-                var nSeqAlpha=0;
-                for (var i=0; i < 23; i++) {
-                    var sFwd=sAlphas.substring(i, i+3);
-                    var sRev=sFwd.strReverse();
-                    if (pass.toLowerCase().indexOf(sFwd) != -1
-                            ||  pass.toLowerCase().indexOf(sRev) != -1)
-                        nSeqAlpha++;
-                }
-
-                // check for sequential numeric string patterns (forward and reverse)
-                var sNumerics="01234567890";
-                var nSeqNumber=0;
-                for (var i=0; i < 8; i++) {
-                    var sFwd=sNumerics.substring(i, i+3);
-                    var sRev=sFwd.strReverse();
-                    if (pass.toLowerCase().indexOf(sFwd) != -1
-                            ||  pass.toLowerCase().indexOf(sRev) != -1)
-                        nSeqNumber++;
-                }
-
-                // general point assignment
-                if (nAlphaUC > 0 && nAlphaUC < nLength)   // uppercase characters
-                    nScore+=2*(nLength-nAlphaUC);
-                if (nAlphaLC > 0 && nAlphaLC < nLength)   // lowercase characters
-                    nScore+=2*(nLength-nAlphaLC);
-                if (nNumber > 0 && nNumber < nLength)   // numbers
-                    nScore+=2*nNumber;
-                if (nSpecial > 0)   // special characters
-                    nScore+=4*nSpecial;
-                if (nMidChar > 0)   // mid numbers/special characters
-                    nScore+=2*nMidChar;
-
-                // point deductions for poor practices
-                if ((nAlphaLC > 0 || nAlphaUC > 0)
-                    && nSpecial === 0 && nNumber === 0)   // characters only
-                    nScore-=nLength;
-                if (nAlphaLC === 0 && nAlphaUC === 0
-                    && nSpecial === 0 && nNumber > 0)   // numbers only
-                    nScore-=nLength;
-                if (nRepChar > 0)   // same character exists more than once
-                    nScore-=nRepInc;
-                if (nConsecAlphaUC > 0)   // consecutive uppercase letters exist
-                    nScore-=2*nConsecAlphaUC;
-                if (nConsecAlphaLC > 0)   // consecutive lowercase letters exist
-                    nScore-=2*nConsecAlphaLC;
-                if (nConsecNumber > 0)   // consecutive numbers exist
-                    nScore-=2*nConsecNumber;
-                if (nSeqAlpha > 0)   // sequential alpha strings exist (3 chars or more)
-                    nScore-=3*nSeqAlpha;
-                if (nSeqNumber > 0)   // sequential numeric strings exist (3 chars or more)
-                    nScore-=3*nSeqNumber;
-
-                // determine if mandatory requirements have been met
-                var arrChars=[nAlphaUC, nAlphaLC, nNumber, nSpecial];
-                var nReqChar=0;
-                for (var i=0; i < arrChars.length; i++) {
-                    if (arrChars[i]) {
-                        nReqChar++;
-                    }
-                }
-                if (nReqChar >= arrChars.length)
-                    nScore+=2*nReqChar;
-                else if (nReqChar < arrChars.length-1)
-                    nScore-=2*nReqChar;
-
-                // limit points to 3..100
-                nScore=Math.max(3, Math.min(nScore, 100));
-
-                // set message according to points
-                if (nScore >= 80)
-                    message=QUAL_STRONG;
-                else if (nScore >= 60)
-                    message=QUAL_GOOD;
-                else if (nScore >= 40)
-                    message=QUAL_MEDIUM;
-                else if (nScore >= 10)
-                    message=QUAL_LOW;
-                else
-                    message=QUAL_NONE;
-            } catch (error) {
-                nScore=3;
-                message=error;
-            }
-/*
-            if (pass.length > 0 && pass2.length > 0) {
-                message+=' / ';
-                message+=(pass == pass2) ? REP_OK : REP_NE;
-            }
-*/
-            $('#pwqinfo').val(message);
-
-            var progress=$('#pwqbar');
-            progress.width(nScore + '%');
-            progress.attr('aria-valuenow', nScore);
-            if (nScore >= 60)
-                progress.removeClass('bg-danger bg-warning').addClass('bg-success');
-            else if (nScore >= 40)
-                progress.removeClass('bg-danger bg-success').addClass('bg-warning');
-            else
-                progress.removeClass('bg-warning bg-success').addClass('bg-danger');
-
-            if (nScore > 60) {
-                $('#btn_change').prop('disabled', pass !== pass2);
-            } else {
-                $('#btn_change').prop('disabled', 1);
-            }
-/*
-            if (nScore >= 60) {
-                checkTimer=setTimeout(function() {
-                    $.post('checkpass.php', 'pass='+pass, function(ret) {
-                        if (ret !== 'PWNED') {
-                            $('#btn_change').prop('disabled', pass !== pass2);
-                            return;
-                        }
-                        $('#pwqinfo').val(PWNED);
-                        progress.removeClass().addClass('low');
-                        progress.val(3);
-                    });
-                }, 300);
-            }
-*/
-        }
-</script>
\ No newline at end of file
