Make WordPress Core

Changeset 33495


Ignore:
Timestamp:
07/29/2015 07:21:26 PM (10 years ago)
Author:
markjaquith
Message:

Persist (and mask) the password on the install screen if the install does not proceed due to errors.

If you forget or enter an invalid username/e-mail, the password choosing shouldn't start over.

fixes #33162

Location:
trunk/src/wp-admin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/install.php

    r33474 r33495  
    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>
  • trunk/src/wp-admin/js/user-profile.js

    r33475 r33495  
    1313        $weakCheckbox,
    1414
     15        $toggleButton,
    1516        $submitButtons,
    1617        $submitButton,
     
    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    }
     
    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({
     
    106111            } else {
    107112                $pass1Wrap.removeClass( 'show-password' );
    108                 toggleButton
     113                $toggleButton
    109114                    .data( 'toggle', 1 )
    110115                    .attr({
Note: See TracChangeset for help on using the changeset viewer.