Ticket #24633: 24633.8.patch
File 24633.8.patch, 12.4 KB (added by , 10 years ago) |
---|
-
src/wp-admin/admin-ajax.php
49 49 ); 50 50 51 51 $core_actions_post = array( 52 'oembed-cache', 'image-editor', 'delete-comment', 'delete-tag','delete-link',53 'delete-meta', 'delete-post', 'trash-post', 'untrash-post', 'delete-page', 'dim-comment',54 'add-link-category', 'add-tag', 'get-tagcloud', 'get-comments','replyto-comment',55 'edit-comment', 'add-menu-item', 'add-meta', 'add-user','closed-postboxes',56 'hidden-columns', 'update-welcome-panel', 'menu-get-metabox', 'wp-link-ajax',57 ' menu-locations-save', 'menu-quick-search', 'meta-box-order', 'get-permalink',58 'sa mple-permalink', 'inline-save', 'inline-save-tax', 'find_posts', 'widgets-order',59 's ave-widget', 'set-post-thumbnail', 'date_format', 'time_format', 'wp-fullscreen-save-post',60 ' wp-remove-post-lock', 'dismiss-wp-pointer', 'upload-attachment', 'get-attachment',61 ' query-attachments', 'save-attachment', 'save-attachment-compat', 'send-link-to-editor',62 ' send-attachment-to-editor', 'save-attachment-order', 'heartbeat', 'get-revision-diffs',63 'save- user-color-scheme', 'update-widget', 'query-themes', 'parse-embed', 'set-attachment-thumbnail'52 'oembed-cache', 'image-editor', 'delete-comment', 'delete-tag', 'delete-link', 53 'delete-meta', 'delete-post', 'trash-post', 'untrash-post', 'delete-page', 54 'add-link-category', 'add-tag', 'get-tagcloud', 'get-comments', 'replyto-comment', 55 'edit-comment', 'add-menu-item', 'add-meta', 'add-user', 'closed-postboxes', 56 'hidden-columns', 'update-welcome-panel', 'menu-get-metabox', 'wp-link-ajax', 'dim-comment', 57 'sample-permalink', 'inline-save', 'inline-save-tax', 'find_posts', 'widgets-order', 58 'save-widget', 'set-post-thumbnail', 'date_format', 'time_format', 'wp-fullscreen-save-post', 59 'send-attachment-to-editor', 'save-attachment-order', 'heartbeat', 'get-revision-diffs', 'generate_password', 60 'save-user-color-scheme', 'update-widget', 'query-themes', 'parse-embed', 'set-attachment-thumbnail', 61 'wp-remove-post-lock', 'dismiss-wp-pointer', 'upload-attachment', 'get-attachment', 'menu-locations-save', 62 'menu-quick-search', 'meta-box-order', 'get-permalink', 'query-attachments', 'save-attachment', 63 'save-attachment-compat', 'send-link-to-editor', 64 64 ); 65 65 66 66 // Register core Ajax calls. -
src/wp-admin/includes/ajax-actions.php
2223 2223 } 2224 2224 2225 2225 /** 2226 * Ajax handler for password generation 2227 * 2228 * @since 4.0 2229 */ 2230 function wp_ajax_generate_password() { 2231 die( wp_generate_password() ); 2232 } 2233 2234 /** 2226 2235 * Ajax handler for saving backwards compatible attachment attributes. 2227 2236 * 2228 2237 * @since 3.5.0 -
src/wp-admin/js/user-profile.js
30 30 } 31 31 } 32 32 33 $(document).ready( function() {34 var $colorpicker, $stylesheet, user_id, current_user_id,35 select = $( '#display_name' );33 var $colorpicker, $stylesheet, user_id, current_user_id, 34 select = $( '#display_name' ), 35 pass1 = $( '#pass1' ); 36 36 37 $('#pass1').val('').keyup( check_pass_strength ); 38 $('#pass2').val('').keyup( check_pass_strength ); 39 $('#pass-strength-result').show(); 40 $('.color-palette').click( function() { 41 $(this).siblings('input[name="admin_color"]').prop('checked', true); 37 /* Passwords */ 38 pass1.val('').keyup(function(e) { 39 if( ! pass1.is(':focus') || 'text' == pass1.attr('type') ) { 40 //return; 41 } 42 check_pass_strength(); 43 changed = true; 44 }); 45 46 $( '#generate-password' ).on( 'click', function() { 47 if( 'profile' == pagenow ) { 48 // User's own password 49 $(pass1).attr( 'type', 'text' ); 50 } else { 51 $(pass1).attr( 'type', 'password' ); 52 } 53 $.post( ajaxurl, { action: 'generate_password' }, function( response ) { 54 pass1.attr('type', 'text'); 55 $( '#show-password' ).text( 'Hide Password' ); 56 pass1.val( response ).trigger('keyup'); 57 pass1.focus(); 42 58 }); 59 }); 60 $( '#show-password' ).on( 'click', function() { 61 if ( 'password' == pass1.attr( 'type' ) ) { 62 pass1.attr('type', 'text'); 63 $( this ).text( 'Hide Password' ); 64 } else { 65 pass1.attr('type', 'password'); 66 $( this ).text( 'Show Password' ); 67 } 43 68 44 if ( select.length ) { 45 $('#first_name, #last_name, #nickname').bind( 'blur.user_profile', function() { 46 var dub = [], 47 inputs = { 48 display_nickname : $('#nickname').val() || '', 49 display_username : $('#user_login').val() || '', 50 display_firstname : $('#first_name').val() || '', 51 display_lastname : $('#last_name').val() || '' 52 }; 69 return false; 70 }); 53 71 54 if ( inputs.display_firstname && inputs.display_lastname ) { 55 inputs.display_firstlast = inputs.display_firstname + ' ' + inputs.display_lastname; 56 inputs.display_lastfirst = inputs.display_lastname + ' ' + inputs.display_firstname; 57 } 72 $( '#pass-strength-result' ).show(); 58 73 59 $.each( $('option', select), function( i, el ){ 60 dub.push( el.value ); 61 }); 74 /* End Passwords */ 62 75 63 $.each(inputs, function( id, value ) { 64 if ( ! value ) { 65 return; 66 } 76 $('.color-palette').click( function() { 77 $(this).siblings('input[name="admin_color"]').prop('checked', true); 78 }); 67 79 68 var val = value.replace(/<\/?[a-z][^>]*>/gi, ''); 80 if ( select.length ) { 81 $('#first_name, #last_name, #nickname').bind( 'blur.user_profile', function() { 82 var dub = [], 83 inputs = { 84 display_nickname : $('#nickname').val() || '', 85 display_username : $('#user_login').val() || '', 86 display_firstname : $('#first_name').val() || '', 87 display_lastname : $('#last_name').val() || '' 88 }; 69 89 70 if ( inputs[id].length && $.inArray( val, dub ) === -1) {71 dub.push(val);72 $('<option />', {73 'text': val74 }).appendTo( select ); 75 }76 });90 if ( inputs.display_firstname && inputs.display_lastname ) { 91 inputs.display_firstlast = inputs.display_firstname + ' ' + inputs.display_lastname; 92 inputs.display_lastfirst = inputs.display_lastname + ' ' + inputs.display_firstname; 93 } 94 95 $.each( $('option', select), function( i, el ){ 96 dub.push( el.value ); 77 97 }); 78 }79 98 80 $colorpicker = $( '#color-picker' );81 $stylesheet = $( '#colors-css' );82 user_id = $( 'input#user_id' ).val();83 current_user_id = $( 'input[name="checkuser_id"]' ).val();99 $.each(inputs, function( id, value ) { 100 if ( ! value ) { 101 return; 102 } 84 103 85 $colorpicker.on( 'click.colorpicker', '.color-option', function() { 86 var colors, 87 $this = $(this); 104 var val = value.replace(/<\/?[a-z][^>]*>/gi, ''); 88 105 89 if ( $this.hasClass( 'selected' ) ) { 90 return; 91 } 106 if ( inputs[id].length && $.inArray( val, dub ) === -1 ) { 107 dub.push(val); 108 $('<option />', { 109 'text': val 110 }).appendTo( select ); 111 } 112 }); 113 }); 114 } 92 115 93 $this.siblings( '.selected' ).removeClass( 'selected' ); 94 $this.addClass( 'selected' ).find( 'input[type="radio"]' ).prop( 'checked', true ); 116 $colorpicker = $( '#color-picker' ); 117 $stylesheet = $( '#colors-css' ); 118 user_id = $( 'input#user_id' ).val(); 119 current_user_id = $( 'input[name="checkuser_id"]' ).val(); 95 120 96 // Set color scheme 97 if ( user_id === current_user_id ) { 98 // Load the colors stylesheet. 99 // The default color scheme won't have one, so we'll need to create an element. 100 if ( 0 === $stylesheet.length ) { 101 $stylesheet = $( '<link rel="stylesheet" />' ).appendTo( 'head' ); 102 } 103 $stylesheet.attr( 'href', $this.children( '.css_url' ).val() ); 121 $colorpicker.on( 'click.colorpicker', '.color-option', function() { 122 var colors, 123 $this = $(this); 104 124 105 // repaint icons 106 if ( typeof wp !== 'undefined' && wp.svgPainter ) { 107 try { 108 colors = $.parseJSON( $this.children( '.icon_colors' ).val() ); 109 } catch ( error ) {} 125 if ( $this.hasClass( 'selected' ) ) { 126 return; 127 } 110 128 111 if ( colors ) { 112 wp.svgPainter.setColors( colors ); 113 wp.svgPainter.paint(); 114 } 129 $this.siblings( '.selected' ).removeClass( 'selected' ); 130 $this.addClass( 'selected' ).find( 'input[type="radio"]' ).prop( 'checked', true ); 131 132 // Set color scheme 133 if ( user_id === current_user_id ) { 134 // Load the colors stylesheet. 135 // The default color scheme won't have one, so we'll need to create an element. 136 if ( 0 === $stylesheet.length ) { 137 $stylesheet = $( '<link rel="stylesheet" />' ).appendTo( 'head' ); 138 } 139 $stylesheet.attr( 'href', $this.children( '.css_url' ).val() ); 140 141 // repaint icons 142 if ( typeof wp !== 'undefined' && wp.svgPainter ) { 143 try { 144 colors = $.parseJSON( $this.children( '.icon_colors' ).val() ); 145 } catch ( error ) {} 146 147 if ( colors ) { 148 wp.svgPainter.setColors( colors ); 149 wp.svgPainter.paint(); 115 150 } 151 } 116 152 117 // update user option 118 $.post( ajaxurl, { 119 action: 'save-user-color-scheme', 120 color_scheme: $this.children( 'input[name="admin_color"]' ).val(), 121 nonce: $('#color-nonce').val() 122 }); 123 } 124 }); 153 // update user option 154 $.post( ajaxurl, { 155 action: 'save-user-color-scheme', 156 color_scheme: $this.children( 'input[name="admin_color"]' ).val(), 157 nonce: $('#color-nonce').val() 158 }); 159 } 125 160 }); 126 161 127 162 })(jQuery); -
src/wp-admin/user-edit.php
456 456 if ( $show_password_fields ) : 457 457 ?> 458 458 <tr id="password"> 459 <th ><label for="pass1"><?php _e( 'New Password' ); ?></label></th>459 <th scope="row"><label for="pass1"><?php _e( 'New Password' ); ?></label></th> 460 460 <td> 461 461 <input class="hidden" value=" " /><!-- #24364 workaround --> 462 <input type="password" name="pass1" id="pass1" class="regular-text" size="16" value="" autocomplete="off" /><br /> 463 <span class="description"><?php _e( 'If you would like to change the password type a new one. Otherwise leave this blank.' ); ?></span> 462 <input name="pass1" type="password" id="pass1" class="regular-text" autocomplete="off" /> 463 <button type="button" id="generate-password" class="button hide-if-no-js"><?php _e( 'Generate Password' ); ?></button> 464 <a href="#" id="show-password"><?php _e( 'Show Password' ); ?></a> 464 465 </td> 465 466 </tr> 466 467 <tr> 467 468 <th scope="row"><label for="pass2"><?php _e( 'Repeat New Password' ); ?></label></th> 468 469 <td> 469 <input name="pass2" type="password" id="pass2" class="regular-text" size="16" value="" autocomplete="off" /><br /> 470 <span class="description" for="pass2"><?php _e( 'Type your new password again.' ); ?></span> 471 <br /> 472 <div id="pass-strength-result"><?php _e( 'Strength indicator' ); ?></div> 473 <p class="description indicator-hint"><?php _e( 'Hint: The password should be at least seven characters long. To make it stronger, use upper and lower case letters, numbers, and symbols like ! " ? $ % ^ & ).' ); ?></p> 470 <input name="pass2" type="password" id="pass2" class="regular-text" value="" autocomplete="off" /><br /> 471 <div id="pass-strength-result"><?php _e('Strength indicator'); ?></div> 472 <p class="description indicator-hint"><?php _e('Hint: The password should be at least seven characters long. To make it stronger, use upper and lower case letters, numbers, and symbols like ! " ? $ % ^ & ).'); ?></p> 474 473 </td> 475 474 </tr> 476 475 <?php endif; ?> -
src/wp-admin/user-new.php
389 389 <td> 390 390 <input class="hidden" value=" " /><!-- #24364 workaround --> 391 391 <input name="pass1" type="password" id="pass1" autocomplete="off" /> 392 <button type="button" id="generate-password" class="button hide-if-no-js"><?php _e( 'Generate Password' ); ?></button> 393 <a href="#" id="show-password"><?php _e( 'Show Password' ); ?></a> 392 394 </td> 393 395 </tr> 394 396 <tr class="form-field form-required">