mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-06-18 02:59:27 +00:00
- adopt to new password strength calculation
This commit is contained in:
parent
6cfdeb71b7
commit
03f2fb730e
|
@ -37,30 +37,23 @@
|
||||||
$.fn.passStrength = function(options) {
|
$.fn.passStrength = function(options) {
|
||||||
|
|
||||||
var defaults = {
|
var defaults = {
|
||||||
minscore: 50
|
onError: function(data) {},
|
||||||
|
onChange: function(data) {},
|
||||||
};
|
};
|
||||||
var opts = $.extend(defaults, options);
|
var opts = $.extend(defaults, options);
|
||||||
|
|
||||||
return this.each(function() {
|
return this.each(function() {
|
||||||
var obj = $(this);
|
var obj = $(this);
|
||||||
|
var target = $(obj).attr('rel');
|
||||||
|
|
||||||
$(obj).unbind().keyup(function() {
|
$(obj).unbind().keyup(function() {
|
||||||
if($(this).val())
|
|
||||||
$("#outerstrength").show();
|
|
||||||
else
|
|
||||||
$("#outerstrength").hide();
|
|
||||||
$.getJSON(opts.url,
|
$.getJSON(opts.url,
|
||||||
{command: 'checkpwstrength', pwd: $(this).val()},
|
{command: 'checkpwstrength', pwd: $(this).val()},
|
||||||
function(data) {
|
function(data) {
|
||||||
if(data.error) {
|
if(data.error) {
|
||||||
|
opts.onError(data, target);
|
||||||
} else {
|
} else {
|
||||||
$("#strength").html(Math.round(data.strength));
|
opts.onChange(data, target);
|
||||||
$("#innerstrength").width(data.strength);
|
|
||||||
if(data.strength > opts.minscore) {
|
|
||||||
$("#innerstrength").css('background-color', 'green');
|
|
||||||
} else {
|
|
||||||
$("#innerstrength").css('background-color', 'red');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue
Block a user