Created
January 30, 2014 11:25
-
-
Save olsgreen/8706692 to your computer and use it in GitHub Desktop.
jQuery Password Complexity Meter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* jQuery Password Complexity Meter | |
*/ | |
(function ($) { | |
$(document).ready(function () { | |
$('.check-complexity').complexify({minimumChars:6, strengthScaleFactor:0.3}, function(valid, complexity){ | |
$('.password-complexity > .progress-bar').css('width', complexity + '%'); | |
if(complexity < 70 && complexity > 40) { | |
$('.password-complexity > .progress-bar').removeClass('progress-bar-danger').removeClass('progress-bar-warning').addClass('progress-bar-warning'); | |
} else if(complexity >= 70) { | |
$('.password-complexity > .progress-bar').removeClass('progress-bar-danger').removeClass('progress-bar-warning').addClass('progress-bar-success'); | |
} else { | |
$('.password-complexity > .progress-bar').addClass('progress-bar-danger').removeClass('progress-bar-warning').addClass('progress-bar-success'); | |
} | |
}); | |
}); | |
}(jQuery)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment