Make WordPress Core


Ignore:
Timestamp:
07/01/2015 02:47:24 PM (10 years ago)
Author:
markjaquith
Message:

New password change/set UI.

  • Generate the password for the user
  • More tightly integrate password strength meter
  • Warn on weak passwords

see #32589

props MikeHansenMe, adamsilverstein, binarykitten

File:
1 edited

Legend:

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

    r32974 r33023  
    191191
    192192wp_enqueue_script('wp-ajax-response');
    193 wp_enqueue_script('user-profile');
     193wp_enqueue_script( 'user-profile' );
    194194
    195195/**
     
    356356$new_user_uri = $creating && isset( $_POST['url'] ) ? wp_unslash( $_POST['url'] ) : '';
    357357$new_user_role = $creating && isset( $_POST['role'] ) ? wp_unslash( $_POST['role'] ) : '';
    358 $new_user_send_password = $creating && isset( $_POST['send_password'] ) ? wp_unslash( $_POST['send_password'] ) : '';
     358$new_user_send_password = $creating && isset( $_POST['send_password'] ) ? wp_unslash( $_POST['send_password'] ) : true;
    359359$new_user_ignore_pass = $creating && isset( $_POST['noconfirmation'] ) ? wp_unslash( $_POST['noconfirmation'] ) : '';
    360360
     
    391391 */
    392392if ( apply_filters( 'show_password_fields', true ) ) : ?>
    393     <tr class="form-field form-required">
    394         <th scope="row"><label for="pass1"><?php _e('Password'); ?> <span class="description"><?php /* translators: password input field */_e('(required)'); ?></span></label></th>
     393    <tr class="form-field form-required user-pass1-wrap">
     394        <th scope="row">
     395            <label for="pass1">
     396                <?php _e( 'Password' ); ?>
     397                <span class="description hide-if-js"><?php /* translators: password input field */_e( '(required)' ); ?></span>
     398            </label>
     399        </th>
    395400        <td>
    396401            <input class="hidden" value=" " /><!-- #24364 workaround -->
    397             <input name="pass1" type="password" id="pass1" autocomplete="off" />
     402            <button type="button" class="button button-secondary wp-generate-pw hide-if-no-js"><?php _e( 'Show password' ); ?></button>
     403            <div class="wp-pwd hide-if-js">
     404                <?php $initial_password = wp_generate_password( 24 ); ?>
     405                <input type="password" name="pass1" id="pass1" class="regular-text" value="<?php echo esc_attr( $initial_password ); ?>" autocomplete="off" data-reveal="1" data-pw="<?php echo esc_attr( $initial_password ); ?>" />
     406                <button type="button" class="button button-secondary wp-hide-pw hide-if-no-js" data-toggle="0">
     407                    <span class="dashicons dashicons-visibility"></span>
     408                    <span class="text">hide</span>
     409                </button>
     410                <div style="display:none" id="pass-strength-result"></div>
     411            </div>
     412            <p><span class="description"><?php _e( 'A password reset link will be sent to the user via email' ); ?></span></p>
    398413        </td>
    399414    </tr>
    400     <tr class="form-field form-required">
    401         <th scope="row"><label for="pass2"><?php _e('Repeat Password'); ?> <span class="description"><?php /* translators: password input field */_e('(required)'); ?></span></label></th>
     415    <tr class="form-field form-required user-pass2-wrap hide-if-js">
     416        <th scope="row"><label for="pass2"><?php _e( 'Repeat Password' ); ?> <span class="description"><?php /* translators: password input field */_e('(required)'); ?></span></label></th>
    402417        <td>
    403418        <input name="pass2" type="password" id="pass2" autocomplete="off" />
    404         <br />
    405         <div id="pass-strength-result"><?php _e('Strength indicator'); ?></div>
    406         <p class="description indicator-hint"><?php echo wp_get_password_hint(); ?></p>
    407419        </td>
    408420    </tr>
    409     <tr>
    410         <th scope="row"><?php _e('Send Password?') ?></th>
    411         <td><label for="send_password"><input type="checkbox" name="send_password" id="send_password" value="1" <?php checked( $new_user_send_password ); ?> /> <?php _e('Send this password to the new user by email.'); ?></label></td>
     421    <tr class="pw-weak">
     422        <th><label for="pw-weak"><?php _e( 'Confirm Password' ); ?></label></th>
     423        <td>
     424            <input type="checkbox" name="pw-weak" class="pw-checkbox" />
     425            <?php _e( 'Confirm use of weak password' ); ?>
     426        </td>
    412427    </tr>
    413428<?php endif; ?>
Note: See TracChangeset for help on using the changeset viewer.