Ticket #33079: 33079.01.patch
File 33079.01.patch, 3.8 KB (added by , 9 years ago) |
---|
-
wp-admin/js/user-profile.js
7 7 pw_field2 = $('#pass2'), 8 8 pw_togglebtn = pw_new.find('.wp-hide-pw'), 9 9 pw_generatebtn = pw_new.find('button.wp-generate-pw'), 10 pw_cancelbtn = pw_new.find('button.wp-cancel-pw'), 10 11 pw_2 = $('.user-pass2-wrap'), 11 12 parentform = pw_new.closest('form'), 12 13 pw_strength = $('#pass-strength-result'), … … 14 15 pw_submitbtn_new = $( '#createusersub' ), 15 16 pw_checkbox = $('.pw-checkbox'), 16 17 pw_weak = $('.pw-weak'), 18 pw_update_lock = false, 17 19 // Set up a text version of the password input 18 20 newField = document.createElement( 'input'); 21 19 22 newField.type = 'text'; 20 23 21 24 var pwFieldText = $( newField ); … … 56 59 } 57 60 58 61 parentform.on('submit', function(){ 62 pw_update_lock = false; 59 63 pw_field2.val( pw_field.val() ); 60 64 pwWrapper.removeClass( 'show-password' ); 61 65 }); … … 110 114 } ); 111 115 112 116 pw_new.on( 'click', 'button.wp-generate-pw', function(){ 117 pw_update_lock = true; 113 118 pw_generatebtn.hide(); 114 119 pw_line.show(); 115 120 generatePassword(); … … 119 124 pwFieldText[0].setSelectionRange( 0, 100 ); 120 125 } 121 126 }, 0 ); 127 }); 122 128 129 pw_submitbtn_edit.on( 'click', function() { 130 pw_update_lock = false; 123 131 }); 124 132 133 pw_cancelbtn.on( 'click', function() { 134 pw_update_lock = false; 135 pw_generatebtn.show(); 136 pw_line.hide(); 137 }); 125 138 126 139 pw_togglebtn.on( 'click', function() { 127 140 var show = pw_togglebtn.attr( 'data-toggle' ); … … 145 158 } 146 159 147 160 }); 161 162 /* Warn the user if password was generated but not saved */ 163 $( window ).on( 'beforeunload', function() { 164 if ( true === pw_update_lock ) { 165 return userProfileL10n.warn; 166 } 167 } ); 148 168 }); 149 169 150 170 function check_pass_strength() { -
wp-admin/user-edit.php
469 469 <span class="dashicons dashicons-visibility"></span> 470 470 <span class="text"><?php _e( 'Hide' ); ?></span> 471 471 </button> 472 <button type="button" class="button button-secondary wp-cancel-pw hide-if-no-js" data-toggle="0" aria-label="<?php esc_attr_e( 'Cancel password change' ); ?>"> 473 <span class="text"><?php _e( 'Cancel' ); ?></span> 474 </button> 472 475 <div style="display:none" id="pass-strength-result" aria-live="polite"></div> 473 476 </div> 474 477 </td> -
wp-admin/user-new.php
407 407 <span class="dashicons dashicons-visibility"></span> 408 408 <span class="text"><?php _e( 'Hide' ); ?></span> 409 409 </button> 410 <button type="button" class="button button-secondary wp-cancel-pw hide-if-no-js" data-toggle="0" aria-label="<?php esc_attr_e( 'Cancel password change' ); ?>"> 411 <span class="text"><?php _e( 'Cancel' ); ?></span> 412 </button> 410 413 <div style="display:none" id="pass-strength-result" aria-live="polite"></div> 411 414 </div> 412 415 <p><span class="description"><?php _e( 'A password reset link will be sent to the user via email.' ); ?></span></p> -
wp-includes/script-loader.php
374 374 375 375 $scripts->add( 'user-profile', "/wp-admin/js/user-profile$suffix.js", array( 'jquery', 'password-strength-meter', 'wp-util' ), false, 1 ); 376 376 did_action( 'init' ) && $scripts->localize( 'user-profile', 'userProfileL10n', array( 377 'show' => __( 'Show' ), 378 'hide' => __( 'Hide' ), 377 'warn' => __( 'Leaving this page will also leave your password unchanged.' ), 378 'show' => __( 'Show' ), 379 'hide' => __( 'Hide' ), 380 'cancel' => __( 'Cancel' ), 379 381 'ariaShow' => esc_attr__( 'Show password' ), 380 382 'ariaHide' => esc_attr__( 'Hide password' ), 381 383 ) );