diff --git a/interface/usergroup/user_info.php b/interface/usergroup/user_info.php index 75b361440d1..85ffdb29f01 100644 --- a/interface/usergroup/user_info.php +++ b/interface/usergroup/user_info.php @@ -127,6 +127,11 @@ function(data)
+ +
+
+
+
diff --git a/interface/usergroup/usergroup_admin_add.php b/interface/usergroup/usergroup_admin_add.php index 70db59860d9..61e05e26bbd 100644 --- a/interface/usergroup/usergroup_admin_add.php +++ b/interface/usergroup/usergroup_admin_add.php @@ -237,7 +237,18 @@ function authorized_clicked() { : -: + + : + + + + + +
+
+
+
+ @@ -645,6 +656,7 @@ function authorized_clicked() { }); +
diff --git a/library/js/utility.js b/library/js/utility.js index c7fcd9dd96b..311c514b381 100644 --- a/library/js/utility.js +++ b/library/js/utility.js @@ -345,7 +345,47 @@ function oeSortable(callBackFn) { } } +// Password Strength Meter JavaScript +function checkPasswordStrength(inputElement) { + var number = /[\p{N}]/u; // Matches any Unicode number character + var alphabets = /[\p{L}]/u; // Matches any Unicode letter character + var special_characters = /[^\p{N}\p{L}]/u; // Matches any character that is not a letter, number, or whitespace + + var pwd = inputElement.value; + var strength = 0; + + if (pwd.length < 6) { + document.getElementById('password_strength_meter').style.backgroundColor = "#ff6666"; + document.getElementById('password_strength_text').innerText = xl('Very Weak'); + } else { + if (pwd.match(number) && pwd.match(alphabets) && pwd.match(special_characters)) { + strength += 3; + } else if (pwd.match(number) && pwd.match(alphabets)) { + strength += 2; + } else if (pwd.match(alphabets)) { + strength += 1; + } + switch (strength) { + case 1: + document.getElementById('password_strength_meter').style.backgroundColor = "#ffcc00"; + document.getElementById('password_strength_text').innerText = xl('Weak'); + break; + case 2: + document.getElementById('password_strength_meter').style.backgroundColor = "#ffcc66"; + document.getElementById('password_strength_text').innerText = xl('Good'); + break; + case 3: + document.getElementById('password_strength_meter').style.backgroundColor = "#99cc00"; + document.getElementById('password_strength_text').innerText = xl('Strong'); + break; + default: + document.getElementById('password_strength_meter').style.backgroundColor = "#ff6666"; + document.getElementById('password_strength_text').innerText = xl('Very Weak'); + break; + } + } +} /* * Universal async BS alert message with promise * Note the use of new javaScript translate function xl().