wp/wp-admin/js/password-strength-meter.js
changeset 5 5e2f62d02dcd
parent 0 d970ebf37754
child 7 cf61fcea0001
equal deleted inserted replaced
4:346c88efed21 5:5e2f62d02dcd
       
     1 /* global zxcvbn */
     1 window.wp = window.wp || {};
     2 window.wp = window.wp || {};
     2 
     3 
     3 var passwordStrength;
     4 var passwordStrength;
     4 (function($){
     5 (function($){
     5 	wp.passwordStrength = {
     6 	wp.passwordStrength = {
    38 
    39 
    39 			userInputFieldsLength = userInputFields.length;
    40 			userInputFieldsLength = userInputFields.length;
    40 			for ( i = 0; i < userInputFieldsLength; i++ ) {
    41 			for ( i = 0; i < userInputFieldsLength; i++ ) {
    41 				currentField = $( '#' + userInputFields[ i ] );
    42 				currentField = $( '#' + userInputFields[ i ] );
    42 
    43 
    43 				if ( 0 == currentField.length ) {
    44 				if ( 0 === currentField.length ) {
    44 					continue;
    45 					continue;
    45 				}
    46 				}
    46 
    47 
    47 				rawValues.push( currentField[0].defaultValue );
    48 				rawValues.push( currentField[0].defaultValue );
    48 				rawValues.push( currentField.val() );
    49 				rawValues.push( currentField.val() );
    56 				}
    57 				}
    57 			}
    58 			}
    58 
    59 
    59 			// Remove empty values, short words, and duplicates. Short words are likely to cause many false positives.
    60 			// Remove empty values, short words, and duplicates. Short words are likely to cause many false positives.
    60 			blacklist = $.grep( blacklist, function( value, key ) {
    61 			blacklist = $.grep( blacklist, function( value, key ) {
    61 				if ( '' == value || 4 > value.length ) {
    62 				if ( '' === value || 4 > value.length ) {
    62 					return false;
    63 					return false;
    63 				}
    64 				}
    64 
    65 
    65 				return $.inArray( value, blacklist ) === key;
    66 				return $.inArray( value, blacklist ) === key;
    66 			});
    67 			});
    67 
    68 
    68 			return blacklist;
    69 			return blacklist;
    69 		}
    70 		}
    70 	}
    71 	};
    71 
    72 
    72 	// Backwards compatibility.
    73 	// Backwards compatibility.
    73 	passwordStrength = wp.passwordStrength.meter;
    74 	passwordStrength = wp.passwordStrength.meter;
    74 })(jQuery);
    75 })(jQuery);