Make WordPress Core

Ticket #39638: 39638.1.diff

File 39638.1.diff, 3.5 KB (added by audrasjb, 4 years ago)

Patch refreshed to change the notice wording.

  • src/js/_enqueues/admin/user-profile.js

    diff --git a/src/js/_enqueues/admin/user-profile.js b/src/js/_enqueues/admin/user-profile.js
    index df17620f48..d4aa676f29 100644
    a b  
    9595                var $generateButton,
    9696                        $cancelButton;
    9797
    98                 $pass1Row = $( '.user-pass1-wrap, .user-pass-wrap' );
     98                $pass1Row = $( '.user-pass1-wrap, .user-pass-wrap, .reset-pass-submit' );
    9999
    100100                // Hide the confirm password field when JavaScript support is enabled.
    101101                $('.user-pass2-wrap').hide();
     
    398398                }
    399399        } );
    400400
     401        /**
     402         * We need to call a generate password as soon as the Rest Password page is loaded
     403         * to avoid double clicking on the button to retrieve the first generated password.
     404         * Ticket: 39638
     405         */
     406        $( document ).ready( function() {
     407                if ( $( '.reset-pass-submit' ).length ) {
     408                        $( '.reset-pass-submit button.wp-generate-pw' ).trigger( 'click' );
     409                }
     410        });
     411
    401412})(jQuery);
  • src/wp-admin/admin-ajax.php

    diff --git a/src/wp-admin/admin-ajax.php b/src/wp-admin/admin-ajax.php
    index 144facf7fe..a539bf5863 100644
    a b if ( ! empty( $_POST['action'] ) && in_array( $_POST['action'], $core_actions_po 
    163163        add_action( 'wp_ajax_' . $_POST['action'], 'wp_ajax_' . str_replace( '-', '_', $_POST['action'] ), 1 );
    164164}
    165165
     166add_action( 'wp_ajax_nopriv_generate-password', 'wp_ajax_nopriv_generate_password' );
     167
    166168add_action( 'wp_ajax_nopriv_heartbeat', 'wp_ajax_nopriv_heartbeat', 1 );
    167169
    168170$action = ( isset( $_REQUEST['action'] ) ) ? $_REQUEST['action'] : '';
  • src/wp-admin/includes/ajax-actions.php

    diff --git a/src/wp-admin/includes/ajax-actions.php b/src/wp-admin/includes/ajax-actions.php
    index 6ff2d2d9fd..019ca53a65 100644
    a b function wp_ajax_generate_password() { 
    39763976        wp_send_json_success( wp_generate_password( 24 ) );
    39773977}
    39783978
     3979/**
     3980 * Ajax handler for generating a password in
     3981 * the no-privilege context.
     3982 *
     3983 * @since 5.7.0
     3984 */
     3985function wp_ajax_nopriv_generate_password() {
     3986        wp_send_json_success( wp_generate_password( 24 ) );
     3987}
     3988
    39793989/**
    39803990 * Ajax handler for saving the user's WordPress.org username.
    39813991 *
  • src/wp-login.php

    diff --git a/src/wp-login.php b/src/wp-login.php
    index 915020f717..384474644e 100644
    a b switch ( $action ) { 
    996996                wp_enqueue_script( 'utils' );
    997997                wp_enqueue_script( 'user-profile' );
    998998
    999                 login_header( __( 'Reset Password' ), '<p class="message reset-pass">' . __( 'Enter your new password below.' ) . '</p>', $errors );
     999                login_header( __( 'Reset Password' ), '<p class="message reset-pass">' . __( 'Enter your new password below or generate one.' ) . '</p>', $errors );
    10001000
    10011001                ?>
    10021002                <form name="resetpassform" id="resetpassform" action="<?php echo esc_url( network_site_url( 'wp-login.php?action=resetpass', 'login_post' ) ); ?>" method="post" autocomplete="off">
    switch ( $action ) { 
    10421042
    10431043                        ?>
    10441044                        <input type="hidden" name="rp_key" value="<?php echo esc_attr( $rp_key ); ?>" />
    1045                         <p class="submit">
    1046                                 <input type="submit" name="wp-submit" id="wp-submit" class="button button-primary button-large" value="<?php esc_attr_e( 'Reset Password' ); ?>" />
     1045                        <p class="submit reset-pass-submit">
     1046                                <button type="button" class="button wp-generate-pw hide-if-no-js" aria-expanded="true">Generate Password</button>
     1047                                <input type="submit" name="wp-submit" id="wp-submit" class="button button-primary button-large" value="<?php esc_attr_e( 'Save Password' ); ?>" />
    10471048                        </p>
    10481049                </form>
    10491050