1var _____WB$wombat$assign$function_____=function(name){return (self._wb_wombat && self._wb_wombat.local_init && self._wb_wombat.local_init(name))||self[name];};if(!self.__WB_pmw){self.__WB_pmw=function(obj){this.__WB_source=obj;return this;}}{ 2let window = _____WB$wombat$assign$function_____("window"); 3let self = _____WB$wombat$assign$function_____("self"); 4let document = _____WB$wombat$assign$function_____("document"); 5let location = _____WB$wombat$assign$function_____("location"); 6let top = _____WB$wombat$assign$function_____("top"); 7let parent = _____WB$wombat$assign$function_____("parent"); 8let frames = _____WB$wombat$assign$function_____("frames"); 9let opens = _____WB$wombat$assign$function_____("opens"); 10/** 11 * @output wp-admin/js/password-strength-meter.js 12 */ 13 14/* global zxcvbn */ 15window.wp = window.wp || {}; 16 17(function($){ 18 var __ = wp.i18n.__, 19 sprintf = wp.i18n.sprintf; 20 21 /** 22 * Contains functions to determine the password strength. 23 * 24 * @since 3.7.0 25 * 26 * @namespace 27 */ 28 wp.passwordStrength = { 29 /** 30 * Determines the strength of a given password. 31 * 32 * Compares first password to the password confirmation. 33 * 34 * @since 3.7.0 35 * 36 * @param {string} password1 The subject password. 37 * @param {Array} disallowedList An array of words that will lower the entropy of 38 * the password. 39 * @param {string} password2 The password confirmation. 40 * 41 * @return {number} The password strength score. 42 */ 43 meter : function( password1, disallowedList, password2 ) { 44 if ( ! Array.isArray( disallowedList ) ) 45 disallowedList = [ disallowedList.toString() ]; 46 47 if (password1 != password2 && password2 && password2.length > 0) 48 return 5; 49 50 if ( 'undefined' === typeof window.zxcvbn ) { 51 // Password strength unknown. 52 return -1; 53 } 54 55 var result = zxcvbn( password1, disallowedList ); 56 return result.score; 57 }, 58 59 /** 60 * Builds an array of words that should be penalized. 61 * 62 * Certain words need to be penalized because it would lower the entropy of a 63 * password if they were used. The disallowedList is based on user input fields such 64 * as username, first name, email etc. 65 * 66 * @since 3.7.0 67 * @deprecated 5.5.0 Use {@see 'userInputDisallowedList()'} instead. 68 * 69 * @return {string[]} The array of words to be disallowed. 70 */ 71 userInputBlacklist : function() { 72 window.console.log( 73 sprintf( 74 /* translators: 1: Deprecated function name, 2: Version number, 3: Alternative function name. */ 75 __( '%1$s is deprecated since version %2$s! Use %3$s instead. Please consider writing more inclusive code.' ), 76 'wp.passwordStrength.userInputBlacklist()', 77 '5.5.0', 78 'wp.passwordStrength.userInputDisallowedList()' 79 ) 80 ); 81 82 return wp.passwordStrength.userInputDisallowedList(); 83 }, 84 85 /** 86 * Builds an array of words that should be penalized. 87 * 88 * Certain words need to be penalized because it would lower the entropy of a 89 * password if they were used. The disallowed list is based on user input fields such 90 * as username, first name, email etc. 91 * 92 * @since 5.5.0 93 * 94 * @return {string[]} The array of words to be disallowed. 95 */ 96 userInputDisallowedList : function() { 97 var i, userInputFieldsLength, rawValuesLength, currentField, 98 rawValues = [], 99 disallowedList = [], 100 userInputFields = [ 'user_login', 'first_name', 'last_name', 'nickname', 'display_name', 'email', 'url', 'description', 'weblog_title', 'admin_email' ]; 101 102 // Collect all the strings we want to disallow. 103 rawValues.push( document.title ); 104 rawValues.push( document.URL ); 105 106 userInputFieldsLength = userInputFields.length; 107 for ( i = 0; i < userInputFieldsLength; i++ ) { 108 currentField = $( '#' + userInputFields[ i ] ); 109 110 if ( 0 === currentField.length ) { 111 continue; 112 } 113 114 rawValues.push( currentField[0].defaultValue ); 115 rawValues.push( currentField.val() ); 116 } 117 118 /* 119 * Strip out non-alphanumeric characters and convert each word to an 120 * individual entry. 121 */ 122 rawValuesLength = rawValues.length; 123 for ( i = 0; i < rawValuesLength; i++ ) { 124 if ( rawValues[ i ] ) { 125 disallowedList = disallowedList.concat( rawValues[ i ].replace( /\W/g, ' ' ).split( ' ' ) ); 126 } 127 } 128 129 /* 130 * Remove empty values, short words and duplicates. Short words are likely to 131 * cause many false positives. 132 */ 133 disallowedList = $.grep( disallowedList, function( value, key ) { 134 if ( '' === value || 4 > value.length ) { 135 return false;
136 } 137 138 return $.inArray( value, disallowedList ) === key; 139 }); 140 141 return disallowedList; 142 } 143 }; 144 145 // Backward compatibility. 146 147 /** 148 * Password strength meter function. 149 * 150 * @since 2.5.0 151 * @deprecated 3.7.0 Use wp.passwordStrength.meter instead. 152 * 153 * @global 154 * 155 * @type {wp.passwordStrength.meter} 156 */ 157 window.passwordStrength = wp.passwordStrength.meter; 158})(jQuery); 159 160}
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.