Ticket #3534: password_show_hide_fix.diff
File password_show_hide_fix.diff, 3.8 KB (added by , 8 years ago) |
---|
-
src/wp-admin/css/install.css
448 448 display: none; 449 449 } 450 450 451 #toggle-password { 452 display: inline-block; 453 padding-top: 10px; 454 } 455 451 456 /** 452 457 * HiDPI Displays 453 458 */ -
src/wp-admin/js/setup-config.js
1 /** 2 * Adds show/hide toggle for the setup config password 3 */ 4 5 (function() { 6 var toggle, status, input, icon, label; 7 toggle = document.getElementById('toggle-password'); 8 toggle.classList.remove('hide-if-no-js'); 9 10 toggle.addEventListener( 'click', togglePassword ); 11 12 function togglePassword() { 13 status = toggle.getAttribute( 'data-toggle' ); 14 console.log(status); 15 input = document.getElementById( 'pwd' ); 16 icon = toggle.getElementsByClassName('dashicons')[0]; 17 label = toggle.getElementsByClassName('text')[0]; 18 19 if( status == 0 ) { 20 toggle.setAttribute( 'data-toggle', 1 ); 21 input.setAttribute( 'type', 'text' ); 22 icon.classList.remove('dashicons-visibility'); 23 icon.classList.add('dashicons-hidden'); 24 label.innerHTML = setupConfigL10n.hide; 25 toggle.setAttribute( 'aria-label', setupConfigL10n.ariaShow ); 26 } else { 27 toggle.setAttribute( 'data-toggle', 0 ); 28 input.setAttribute( 'type', 'password' ); 29 icon.classList.remove('dashicons-hidden'); 30 icon.classList.add('dashicons-visibility'); 31 label.innerHTML = setupConfigL10n.show; 32 toggle.setAttribute( 'aria-label', setupConfigL10n.ariaHide ); 33 } 34 } 35 })(); 36 No newline at end of file -
src/wp-admin/setup-config.php
199 199 </tr> 200 200 <tr> 201 201 <th scope="row"><label for="pwd"><?php _e( 'Password' ); ?></label></th> 202 <td><input name="pwd" id="pwd" type="text" size="25" value="<?php echo htmlspecialchars( _x( 'password', 'example password' ), ENT_QUOTES ); ?>" autocomplete="off" /></td> 203 <td><?php _e( 'Your database password.' ); ?></td> 202 <td> 203 <input name="pwd" id="pwd" type="password" size="25" placeholder="<?php echo htmlspecialchars( _x( 'password', 'example password' ), ENT_QUOTES ); ?>" autocomplete="off" /> 204 <button id="toggle-password" type="button" class="button button-secondary wp-toggle-pw hide-if-no-js" data-toggle="0" aria-label="Show password"> 205 <span class="dashicons dashicons-visibility"></span> 206 <span class="text"><?php _e( 'Show' ); ?></span> 207 </button> 208 </td> 209 <td><?php _e( '…and your MySQL password.' ); ?></td> 204 210 </tr> 205 211 <tr> 206 212 <th scope="row"><label for="dbhost"><?php _e( 'Database Host' ); ?></label></th> -
src/wp-includes/script-loader.php
397 397 'ariaHide' => esc_attr__( 'Hide password' ), 398 398 ) ); 399 399 400 $scripts->add( 'setup-config', "/wp-admin/js/setup-config$suffix.js", array(), false, 1 ); 401 did_action( 'init' ) && $scripts->localize( 'setup-config', 'setupConfigL10n', array( 402 'show' => __( 'Show' ), 403 'hide' => __( 'Hide' ), 404 'ariaShow' => esc_attr__( 'Show password' ), 405 'ariaHide' => esc_attr__( 'Hide password' ), 406 ) ); 407 400 408 $scripts->add( 'language-chooser', "/wp-admin/js/language-chooser$suffix.js", array( 'jquery' ), false, 1 ); 401 409 402 410 $scripts->add( 'user-suggest', "/wp-admin/js/user-suggest$suffix.js", array( 'jquery-ui-autocomplete' ), false, 1 );