Make WordPress Core

Ticket #33162: 33162.2.diff

File 33162.2.diff, 2.5 KB (added by markjaquith, 10 years ago)
  • src/wp-admin/install.php

    diff --git src/wp-admin/install.php src/wp-admin/install.php
    index 4eab6b3..2c0c607 100644
    function display_setup_form( $error = null ) { 
    137137                        </th>
    138138                        <td>
    139139                                <div class="">
    140                                         <?php $initial_password = wp_generate_password( 18 ); ?>
     140                                        <?php $initial_password = isset( $_POST['admin_password'] ) ? stripslashes( $_POST['admin_password'] ) : wp_generate_password( 18 ); ?>
    141141                                        <input type="password" name="admin_password" id="pass1" class="regular-text" autocomplete="off" data-reveal="1" data-pw="<?php echo esc_attr( $initial_password ); ?>" aria-describedby="pass-strength-result" />
    142                                         <button type="button" class="button button-secondary wp-hide-pw hide-if-no-js" data-toggle="0" aria-label="<?php esc_attr_e( 'Hide password' ); ?>">
     142                                        <button type="button" class="button button-secondary wp-hide-pw hide-if-no-js" data-start-masked="<?php echo (int) isset( $_POST['admin_password'] ); ?>" data-toggle="0" aria-label="<?php esc_attr_e( 'Hide password' ); ?>">
    143143                                                <span class="dashicons dashicons-hidden"></span>
    144144                                                <span class="text"><?php _e( 'Hide' ); ?></span>
    145145                                        </button>
  • src/wp-admin/js/user-profile.js

    diff --git src/wp-admin/js/user-profile.js src/wp-admin/js/user-profile.js
    index 799ee97..bb80a32 100644
     
    1212                $weakRow,
    1313                $weakCheckbox,
    1414
     15                $toggleButton,
    1516                $submitButtons,
    1617                $submitButton,
    1718                currentPass;
     
    2223                } else {
    2324                        $pass1.val( $pass1.data( 'pw' ) );
    2425                        $pass1.trigger( 'pwupdate' );
    25                         $pass1Wrap.addClass( 'show-password' );
     26                        if ( 1 !== parseInt( $toggleButton.data( 'start-masked' ), 10 ) ) {
     27                                $pass1Wrap.addClass( 'show-password' );
     28                        } else {
     29                                $toggleButton.trigger( 'click' );
     30                        }
    2631                }
    2732        }
    2833
     
    8287        }
    8388
    8489        function bindToggleButton() {
    85                 var toggleButton = $pass1Row.find('.wp-hide-pw');
    86                 toggleButton.show().on( 'click', function () {
    87                         if ( 1 === parseInt( toggleButton.data( 'toggle' ), 10 ) ) {
     90                $toggleButton = $pass1Row.find('.wp-hide-pw');
     91                $toggleButton.show().on( 'click', function () {
     92                        if ( 1 === parseInt( $toggleButton.data( 'toggle' ), 10 ) ) {
    8893                                $pass1Wrap.addClass( 'show-password' );
    89                                 toggleButton
     94                                $toggleButton
    9095                                        .data( 'toggle', 0 )
    9196                                        .attr({
    9297                                                'aria-label': userProfileL10n.ariaHide
     
    105110                                }
    106111                        } else {
    107112                                $pass1Wrap.removeClass( 'show-password' );
    108                                 toggleButton
     113                                $toggleButton
    109114                                        .data( 'toggle', 1 )
    110115                                        .attr({
    111116                                                'aria-label': userProfileL10n.ariaShow