Skip to content

Instantly share code, notes, and snippets.

@DimitarChristoff
Created April 23, 2012 22:02
Show Gist options
  • Save DimitarChristoff/2474187 to your computer and use it in GitHub Desktop.
Save DimitarChristoff/2474187 to your computer and use it in GitHub Desktop.
ownies logic.
if (range == -200) {
indx = 0;
range = 0;
}
else {
if (range < 0 && range > -199) {
indx = 0;
}
else {
if (range <= this.options.scores[0]) {
indx = 1;
}
else {
if (range >= this.options.scores[0] && range <= this.options.scores[1]) {
indx = 2;
}
else {
if (range >= this.options.scores[1] && range <= this.options.scores[2]) {
indx = 3;
}
else {
if (range >= this.options.scores[2] && range <= this.options.scores[3]) {
indx = 4;
}
else {
indx = 5;
}
}
}
}
}
}
checkPassword: function(C) {
this.stbox.setStyle("display", "block");
var F = 0;
var B = this.options.minchar;
if (C.length < B) {
F = (F - 100);
} else {
if (C.length >= B.minchar && C.length <= (B.minchar + 2)) {
F = (F + 6);
}
else {
if (C.length >= (B.minchar + 3) && C.length <= (B.minchar + 4)) {
F = (F + 12);
}
else {
if (C.length >= (B.minchar + 5)) {
F = (F + 18);
}
}
}
}
if (C.match(/[a-z]/)) {
F = (F + 1);
}
if (C.match(/[A-Z]/)) {
F = (F + 5);
}
if (C.match(/\d+/)) {
F = (F + 5);
}
if (C.match(/(.*[0-9].*[0-9].*[0-9])/)) {
F = (F + 7);
}
if (C.match(/.[!,@,#,$,%,^,&,*,?,_,~]/)) {
F = (F + 5);
}
if (C.match(/(.*[!,@,#,$,%,^,&,*,?,_,~].*[!,@,#,$,%,^,&,*,?,_,~])/)) {
F = (F + 7);
}
if (C.match(/([a-z].*[A-Z])|([A-Z].*[a-z])/)) {
F = (F + 2);
}
if (C.match(/([a-zA-Z])/) && C.match(/([0-9])/)) {
F = (F + 3);
}
if (C.match(/([a-zA-Z0-9].*[!,@,#,$,%,^,&,*,?,_,~])|([!,@,#,$,%,^,&,*,?,_,~].*[a-zA-Z0-9])/)) {
F = (F + 3);
}
if (F > 0)
F += C.length;
return F;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment