public/assets/js/core/complexify/jquery.complexify.min.js

Summary

Maintainability
A
0 mins
Test Coverage
/*
    http://github.com/danpalmer/jquery.complexify.js
    This code is distributed under the WTFPL v2:
*/
(function(f){f.fn.extend({complexify:function(c,i){var j=[[48,57],[65,90],[97,122],[33,47],[58,64],[91,96],[123,126],[128,255],[256,383],[384,591],[592,687],[688,767],[768,879],[880,1023],[1024,1279],[1328,1423],[1424,1535],[1536,1791],[1792,1871],[1920,1983],[2304,2431],[2432,2559],[2560,2687],[2688,2815],[2816,2943],[2944,3071],[3072,3199],[3200,3327],[3328,3455],[3456,3583],[3584,3711],[3712,3839],[3840,4095],[4096,4255],[4256,4351],[4352,4607],[4608,4991],[5024,5119],[5120,5759],[5760,5791],[5792,
5887],[6016,6143],[6144,6319],[7680,7935],[7936,8191],[8192,8303],[8304,8351],[8352,8399],[8400,8447],[8448,8527],[8528,8591],[8592,8703],[8704,8959],[8960,9215],[9216,9279],[9280,9311],[9312,9471],[9472,9599],[9600,9631],[9632,9727],[9728,9983],[9984,10175],[10240,10495],[11904,12031],[12032,12255],[12272,12287],[12288,12351],[12352,12447],[12448,12543],[12544,12591],[12592,12687],[12688,12703],[12704,12735],[12800,13055],[13056,13311],[13312,19893],[19968,40959],[40960,42127],[42128,42191],[44032,
55203],[55296,56191],[56192,56319],[56320,57343],[57344,63743],[63744,64255],[64256,64335],[64336,65023],[65056,65071],[65072,65103],[65104,65135],[65136,65278],[65279,65279],[65280,65519],[65520,65533]];f.isFunction(c)&&!i&&(i=c,c={});c=f.extend({minimumChars:8,strengthScaleFactor:1,bannedPasswords:[],banmode:"strict",preventSubmit:!0},c);return this.each(function(){f(this).keyup(function(){var e=f(this).val(),d=0,a=false;a:{a=e;if(c.banmode==="strict"){for(var b=1;b<=a.length;b++)if(f.inArray(a.substr(0,
b),c.bannedPasswords)>-1){a=true;break a}a=false}else a=f.inArray(a,c.bannedPasswords)>-1?true:false}if(a)d=1;else{for(var e=e.split(""),a="",g,b=0;b<e.length;b++){e[b]!==g&&(a=a+e[b]);g=e[b]}e=a;for(g=j.length-1;g>=0;g--){a:{for(var a=e,b=j[g],h=a.length-1;h>=0;h--)if(b[0]<=a.charCodeAt(h)&&a.charCodeAt(h)<=b[1]){a=b[1]-b[0]+1;break a}a=0}d=d+a}}d=Math.log(Math.pow(d,e.length))*(1/c.strengthScaleFactor);a=d>49&&e.length>=c.minimumChars;d=d/120*100;d=d>100?100:d;if(c.preventSubmit!==false){f(this).closest("form").unbind("submit.complexify");
a||f(this).closest("form").bind("submit.complexify",function(a){if(f.isFunction(c.preventSubmit))return c.preventSubmit.call(this,a);a.preventDefault();alert("Please provide a more complex password");return false})}i.call(this,a,d)}).keyup()})}})})(jQuery);