1;( function( $, window, document, undefined ) { 2 3 "use strict"; 4 5 // Create the defaults once 6 var pluginName = "PasswordStrengthManager", 7 defaults = { 8 password: "", 9 confirm_pass : "", 10 blackList : [], 11 minChars : "", 12 maxChars : "" 13 }; 14 15 // The actual plugin constructor 16 function Plugin ( element, options ) { 17 this.element = element; 18 this.settings = $.extend( {}, defaults, options ); 19 this._defaults = defaults; 20 this._name = pluginName; 21 this.init(); 22 this.info = ""; 23 } 24 25 // Avoid Plugin.prototype conflicts 26 $.extend( Plugin.prototype, { 27 init: function() { 28 var errors = this.customValidators(); 29 30 if ("" == this.settings.password) { 31 this.info = ""; 32 } else if (this.settings.confirm_pass && (this.settings.password != this.settings.confirm_pass)) { 33 this.msg = "ë¹ë°ë²í¸ê° ìë¡ ì¼ì¹íì§ ììµëë¤."; 34 } else if (errors == 0) { 35 this.msg = ""; 36 var strength = zxcvbn(this.settings.password, this.settings.blackList); 37 this.info = 'security_'+strength.score; 38 } 39 $(this.element).attr('class', this.info); 40 $(this.element).find('.security_text').html(this.msg); 41 }, 42 43 minChars: function() { 44 if (this.settings.password.length < this.settings.minChars) { 45 this.msg = "ë¹ë°ë²í¸ë ìµì " + this.settings.minChars + "ì ì´ì ì ë ¥íì ì¼ í©ëë¤."; 46 return false; 47 } else { 48 return true; 49 } 50 }, 51 52 maxChars: function() { 53 if (this.settings.password.length > this.settings.maxChars) { 54 this.msg = "ë¹ë°ë²í¸ë ìµë " + this.settings.maxChars + "ìê¹ì§ ì¬ì©íì¤ ì ììµëë¤."; 55 return false; 56 } else { 57 return true; 58 } 59 }, 60 61 customValidators: function() { 62 var err = 0; 63 64 if (this.settings.minChars != "") { 65 if (!this.minChars()) { 66 err++; 67 } 68 } 69 if (this.settings.maxChars != "") { 70 if (!this.maxChars()) { 71 err++; 72 } 73 } 74 return err; 75 } 76 } ); 77 78 $.fn[pluginName] = function (options) { 79 this.each(function() { 80 $.data(this, "plugin_" + pluginName, new Plugin(this, options)); 81 }); 82 return this; 83 }; 84 85} )( jQuery, window, document );
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.