Skip to content

Commit 8c9b768

Browse files
committed
Release v3.0.4
1 parent ac2cb83 commit 8c9b768

File tree

7 files changed

+60
-42
lines changed

7 files changed

+60
-42
lines changed

CHANGES.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# CHANGELOG
22

3-
## 3.0.4dev
3+
## 3.0.4
44

55
- Fix ruleIsMet method, include added custom validation rules.
66
- Fix conflict between progressBarMinWidth and progressBarEmptyPercentage

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "pwstrength-bootstrap",
3-
"version": "3.0.3",
3+
"version": "3.0.4",
44
"homepage": "https://github.com/ablanco/jquery.pwstrength.bootstrap",
55
"authors": [
66
"Alejandro Blanco <[email protected]>"

dist/pwstrength-bootstrap.js

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*!
22
* jQuery Password Strength plugin for Twitter Bootstrap
3-
* Version: 3.0.3
3+
* Version: 3.0.4
44
*
55
* Copyright (c) 2008-2013 Tane Piper
66
* Copyright (c) 2013 Alejandro Blanco
@@ -115,7 +115,6 @@ try {
115115
return word.length > options.common.maxChar ? 0 : score;
116116
};
117117

118-
119118
validation.wordSimilarToUsername = function (options, word, score) {
120119
var username = $(options.common.usernameField).val();
121120
if (username && word.toLowerCase().match(username.replace(/[\-\[\]\/\{\}\(\)\*\+\=\?\:\.\\\^\$\|\!\,]/g, "\\$&").toLowerCase())) {
@@ -630,7 +629,11 @@ var ui = {};
630629
} else {
631630
$bar.addClass("bg-" + options.ui.colorClasses[cssClass]);
632631
}
633-
$bar.css("min-width", options.ui.progressBarMinWidth + 'px');
632+
if (percentage > 0) {
633+
$bar.css("min-width", options.ui.progressBarMinWidth + 'px');
634+
} else {
635+
$bar.css("min-width", '');
636+
}
634637
$bar.css("width", percentage + '%');
635638
};
636639

@@ -964,25 +967,31 @@ var methods = {};
964967
};
965968

966969
methods.ruleIsMet = function (rule) {
967-
if ($.isFunction(rulesEngine.validation[rule])) {
968-
if (rule === "wordMinLength") {
969-
rule = "wordMinLengthStaticScore";
970-
} else if (rule === "wordMaxLength") {
971-
rule = "wordMaxLengthStaticScore";
972-
}
970+
var rulesMetCnt = 0;
973971

974-
var rulesMetCnt = 0;
975-
976-
this.each(function (idx, el) {
977-
var options = $(el).data("pwstrength-bootstrap");
972+
if (rule === "wordMinLength") {
973+
rule = "wordMinLengthStaticScore";
974+
} else if (rule === "wordMaxLength") {
975+
rule = "wordMaxLengthStaticScore";
976+
}
978977

979-
rulesMetCnt += rulesEngine.validation[rule](options, $(el).val(), 1);
980-
});
978+
this.each(function (idx, el) {
979+
var options = $(el).data("pwstrength-bootstrap"),
980+
ruleFunction = rulesEngine.validation[rule],
981+
result;
981982

982-
return (rulesMetCnt === this.length);
983-
}
983+
if (!$.isFunction(ruleFunction)) {
984+
ruleFunction = options.rules.extra[rule];
985+
}
986+
if ($.isFunction(ruleFunction)) {
987+
result = ruleFunction(options, $(el).val(), 1);
988+
if ($.isNumeric(result)) {
989+
rulesMetCnt += result;
990+
}
991+
}
992+
});
984993

985-
$.error("Rule " + rule + " does not exist on jQuery.pwstrength-bootstrap.validation");
994+
return (rulesMetCnt === this.length);
986995
};
987996

988997
$.fn.pwstrength = function (method) {

dist/pwstrength-bootstrap.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/pwstrength-bootstrap.min.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/pwstrength.js

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*!
22
* jQuery Password Strength plugin for Twitter Bootstrap
3-
* Version: 3.0.3
3+
* Version: 3.0.4
44
*
55
* Copyright (c) 2008-2013 Tane Piper
66
* Copyright (c) 2013 Alejandro Blanco
@@ -115,7 +115,6 @@ try {
115115
return word.length > options.common.maxChar ? 0 : score;
116116
};
117117

118-
119118
validation.wordSimilarToUsername = function (options, word, score) {
120119
var username = $(options.common.usernameField).val();
121120
if (username && word.toLowerCase().match(username.replace(/[\-\[\]\/\{\}\(\)\*\+\=\?\:\.\\\^\$\|\!\,]/g, "\\$&").toLowerCase())) {
@@ -630,7 +629,11 @@ var ui = {};
630629
} else {
631630
$bar.addClass("bg-" + options.ui.colorClasses[cssClass]);
632631
}
633-
$bar.css("min-width", options.ui.progressBarMinWidth + 'px');
632+
if (percentage > 0) {
633+
$bar.css("min-width", options.ui.progressBarMinWidth + 'px');
634+
} else {
635+
$bar.css("min-width", '');
636+
}
634637
$bar.css("width", percentage + '%');
635638
};
636639

@@ -964,25 +967,31 @@ var methods = {};
964967
};
965968

966969
methods.ruleIsMet = function (rule) {
967-
if ($.isFunction(rulesEngine.validation[rule])) {
968-
if (rule === "wordMinLength") {
969-
rule = "wordMinLengthStaticScore";
970-
} else if (rule === "wordMaxLength") {
971-
rule = "wordMaxLengthStaticScore";
972-
}
970+
var rulesMetCnt = 0;
973971

974-
var rulesMetCnt = 0;
975-
976-
this.each(function (idx, el) {
977-
var options = $(el).data("pwstrength-bootstrap");
972+
if (rule === "wordMinLength") {
973+
rule = "wordMinLengthStaticScore";
974+
} else if (rule === "wordMaxLength") {
975+
rule = "wordMaxLengthStaticScore";
976+
}
978977

979-
rulesMetCnt += rulesEngine.validation[rule](options, $(el).val(), 1);
980-
});
978+
this.each(function (idx, el) {
979+
var options = $(el).data("pwstrength-bootstrap"),
980+
ruleFunction = rulesEngine.validation[rule],
981+
result;
981982

982-
return (rulesMetCnt === this.length);
983-
}
983+
if (!$.isFunction(ruleFunction)) {
984+
ruleFunction = options.rules.extra[rule];
985+
}
986+
if ($.isFunction(ruleFunction)) {
987+
result = ruleFunction(options, $(el).val(), 1);
988+
if ($.isNumeric(result)) {
989+
rulesMetCnt += result;
990+
}
991+
}
992+
});
984993

985-
$.error("Rule " + rule + " does not exist on jQuery.pwstrength-bootstrap.validation");
994+
return (rulesMetCnt === this.length);
986995
};
987996

988997
$.fn.pwstrength = function (method) {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "pwstrength-bootstrap",
3-
"version": "3.0.3",
3+
"version": "3.0.4",
44
"description": "jQuery plugin for Twitter Bootstrap that provides rulesets for visualy displaying the quality of a users typed in password.",
55
"author": "Alejandro Blanco <[email protected]>",
66
"homepage": "https://github.com/ablanco/jquery.pwstrength.bootstrap",

0 commit comments

Comments
 (0)