Update WP and plugins
This commit is contained in:
parent
10a4713229
commit
1fb77fc4ff
864 changed files with 101724 additions and 78262 deletions
|
|
@ -1,15 +1,33 @@
|
|||
/**
|
||||
* @output wp-admin/js/password-strength-meter.js
|
||||
*/
|
||||
|
||||
/* global zxcvbn */
|
||||
window.wp = window.wp || {};
|
||||
|
||||
var passwordStrength;
|
||||
(function($){
|
||||
|
||||
/**
|
||||
* Contains functions to determine the password strength.
|
||||
*
|
||||
* @since 3.7.0
|
||||
*
|
||||
* @namespace
|
||||
*/
|
||||
wp.passwordStrength = {
|
||||
/**
|
||||
* Determine the strength of a given password
|
||||
* Determines the strength of a given password.
|
||||
*
|
||||
* @param string password1 The password
|
||||
* @param array blacklist An array of words that will lower the entropy of the password
|
||||
* @param string password2 The confirmed password
|
||||
* Compares first password to the password confirmation.
|
||||
*
|
||||
* @since 3.7.0
|
||||
*
|
||||
* @param {string} password1 The subject password.
|
||||
* @param {Array} blacklist An array of words that will lower the entropy of
|
||||
* the password.
|
||||
* @param {string} password2 The password confirmation.
|
||||
*
|
||||
* @returns {number} The password strength score.
|
||||
*/
|
||||
meter : function( password1, blacklist, password2 ) {
|
||||
if ( ! $.isArray( blacklist ) )
|
||||
|
|
@ -28,9 +46,15 @@ var passwordStrength;
|
|||
},
|
||||
|
||||
/**
|
||||
* Builds an array of data that should be penalized, because it would lower the entropy of a password if it were used
|
||||
* Builds an array of words that should be penalized.
|
||||
*
|
||||
* @return array The array of data to be blacklisted
|
||||
* Certain words need to be penalized because it would lower the entropy of a
|
||||
* password if they were used. The blacklist is based on user input fields such
|
||||
* as username, first name, email etc.
|
||||
*
|
||||
* @since 3.7.0
|
||||
*
|
||||
* @returns {string[]} The array of words to be blacklisted.
|
||||
*/
|
||||
userInputBlacklist : function() {
|
||||
var i, userInputFieldsLength, rawValuesLength, currentField,
|
||||
|
|
@ -38,7 +62,7 @@ var passwordStrength;
|
|||
blacklist = [],
|
||||
userInputFields = [ 'user_login', 'first_name', 'last_name', 'nickname', 'display_name', 'email', 'url', 'description', 'weblog_title', 'admin_email' ];
|
||||
|
||||
// Collect all the strings we want to blacklist
|
||||
// Collect all the strings we want to blacklist.
|
||||
rawValues.push( document.title );
|
||||
rawValues.push( document.URL );
|
||||
|
||||
|
|
@ -54,7 +78,10 @@ var passwordStrength;
|
|||
rawValues.push( currentField.val() );
|
||||
}
|
||||
|
||||
// Strip out non-alphanumeric characters and convert each word to an individual entry
|
||||
/*
|
||||
* Strip out non-alphanumeric characters and convert each word to an
|
||||
* individual entry.
|
||||
*/
|
||||
rawValuesLength = rawValues.length;
|
||||
for ( i = 0; i < rawValuesLength; i++ ) {
|
||||
if ( rawValues[ i ] ) {
|
||||
|
|
@ -62,7 +89,10 @@ var passwordStrength;
|
|||
}
|
||||
}
|
||||
|
||||
// Remove empty values, short words, and duplicates. Short words are likely to cause many false positives.
|
||||
/*
|
||||
* Remove empty values, short words and duplicates. Short words are likely to
|
||||
* cause many false positives.
|
||||
*/
|
||||
blacklist = $.grep( blacklist, function( value, key ) {
|
||||
if ( '' === value || 4 > value.length ) {
|
||||
return false;
|
||||
|
|
@ -75,6 +105,17 @@ var passwordStrength;
|
|||
}
|
||||
};
|
||||
|
||||
// Back-compat.
|
||||
passwordStrength = wp.passwordStrength.meter;
|
||||
// Backward compatibility.
|
||||
|
||||
/**
|
||||
* Password strength meter function.
|
||||
*
|
||||
* @since 2.5.0
|
||||
* @deprecated 3.7.0 Use wp.passwordStrength.meter instead.
|
||||
*
|
||||
* @global
|
||||
*
|
||||
* @type {wp.passwordStrength.meter}
|
||||
*/
|
||||
window.passwordStrength = wp.passwordStrength.meter;
|
||||
})(jQuery);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue