mirror of
https://github.com/ansible/awx.git
synced 2026-05-16 05:47:38 -02:30
Password strength meter
Now enforcing the minimum of 8 characters (as it has always been stated in the help text). When the strength score is >= required strength the meter turns green (as it always has) and now goes to 100% of the width. Previously it only went to about 50% of screen width.
This commit is contained in:
@@ -279,17 +279,24 @@ function chkPass(pwd) {
|
||||
sSeqSymbol = "- " + parseInt(nSeqSymbol * nMultSeqSymbol);
|
||||
}
|
||||
|
||||
progbar = $("#progbar");
|
||||
required_strength = $AnsibleConfig.password_strength;
|
||||
warning_level = ($AnsibleConfig.password_strength - 15 < 0) ? 0 : $AnsibleConfig.password_strength - 15;
|
||||
|
||||
/* Enforce a minimum length of 8 */
|
||||
if (nLength < 8) {
|
||||
nScore = 0;
|
||||
}
|
||||
|
||||
/* Determine complexity based on overall score */
|
||||
if (nScore > 100) {
|
||||
nScore = 100;
|
||||
} else if (nScore < 0) {
|
||||
nScore = 0;
|
||||
} else if (nScore >= required_strength) {
|
||||
nScore = 100; //a green progress bar should be at 100%
|
||||
}
|
||||
|
||||
progbar = $("#progbar");
|
||||
required_strength = $AnsibleConfig.password_strength;
|
||||
warning_level = ($AnsibleConfig.password_strength - 15 < 0) ? 0 : $AnsibleConfig.password_strength - 15;
|
||||
|
||||
progbar.css("width", nScore + '%');
|
||||
|
||||
if (nScore >= 0 && nScore <= warning_level) {
|
||||
@@ -311,5 +318,6 @@ function chkPass(pwd) {
|
||||
progbar.css("width", '0%');
|
||||
progbar.removeClass('progress-bar-success progress-bar-warning');
|
||||
}
|
||||
|
||||
return nScore;
|
||||
}
|
||||
Reference in New Issue
Block a user