Make WordPress Core

Changeset 55974

Timestamp:
06/22/2023 12:30:41 AM (13 months ago)
Author:
joedolson
Message:

Administration: Hide password in options/writing.

Hide the password for the "Post via e-mail" settings in writing options. Use the same password hiding mechanisms in use elsewhere in core.

Props mastrup, denis-de-bernardy, ryan, brookedot, wojtek.szkutnik, dd32, sabreuse, sergeybiryukov, costdev, peterwilsoncc, zgrkaralar, clorith, renyot, sabernhardt, boniu91, ironprogrammer, bgoewert.
Fixes #9883.

Location:
trunk/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/js/_enqueues/admin/user-profile.js

    r53122 r55974  
    5353
    5454        // Focus the password field.
    55         $( $pass1 ).trigger( 'focus' );
     55        if ( 'mailserver_pass' !== $pass1.prop('id' ) ) {
     56            $( $pass1 ).trigger( 'focus' );
     57        }
    5658    }
    5759
     
    172174            $cancelButton;
    173175
    174         $pass1Row = $( '.user-pass1-wrap, .user-pass-wrap, .reset-pass-submit' );
     176        $pass1Row = $( '.user-pass1-wrap, .user-pass-wrap, .reset-pass-submit' );
    175177
    176178        // Hide the confirm password field when JavaScript support is enabled.
     
    189191        } );
    190192
    191         $pass1 = $('#pass1');
     193        $pass1 = $('#pass1');
    192194        if ( $pass1.length ) {
    193195            bindPass1();
     
    315317
    316318    function showOrHideWeakPasswordCheckbox() {
    317         var passStrength = $('#pass-strength-result')[0];
    318 
    319         if ( passStrength.className ) {
    320             $pass1.addClass( passStrength.className );
    321             if ( $( passStrength ).is( '.short, .bad' ) ) {
    322                 if ( ! $weakCheckbox.prop( 'checked' ) ) {
    323                     $submitButtons.prop( 'disabled', true );
     319        var passStrengthResult = $('#pass-strength-result');
     320
     321        if ( passStrengthResult.length ) {
     322            var passStrength = passStrengthResult[0];
     323
     324            if ( passStrength.className ) {
     325                $pass1.addClass( passStrength.className );
     326                if ( $( passStrength ).is( '.short, .bad' ) ) {
     327                    if ( ! $weakCheckbox.prop( 'checked' ) ) {
     328                        $submitButtons.prop( 'disabled', true );
     329                    }
     330                    $weakRow.show();
     331                } else {
     332                    if ( $( passStrength ).is( '.empty' ) ) {
     333                        $submitButtons.prop( 'disabled', true );
     334                        $weakCheckbox.prop( 'checked', false );
     335                    } else {
     336                        $submitButtons.prop( 'disabled', false );
     337                    }
     338                    $weakRow.hide();
    324339                }
    325                 $weakRow.show();
    326             } else {
    327                 if ( $( passStrength ).is( '.empty' ) ) {
    328                     $submitButtons.prop( 'disabled', true );
    329                     $weakCheckbox.prop( 'checked', false );
    330                 } else {
    331                     $submitButtons.prop( 'disabled', false );
    332                 }
    333                 $weakRow.hide();
    334340            }
    335341        }
  • trunk/src/wp-admin/css/forms.css

    r55689 r55974  
    552552.wp-pwd {
    553553    margin-top: 1em;
     554
     555
     556
     557
     558
     559
     560
     561
     562
     563
     564
     565
     566
     567
     568
     569
     570
     571
     572
     573
     574
     575
     576
     577
     578
     579
     580
     581
     582
     583
     584
     585
     586
     587
     588
     589
     590
     591
     592
     593
     594
     595
     596
     597
     598
     599
     600
     601
    554602}
    555603
  • trunk/src/wp-admin/options-writing.php

    r55904 r55974  
    5454    '<p>' . __( '<a href="https://wordpress.org/support/forums/">Support forums</a>' ) . '</p>'
    5555);
     56
     57
    5658
    5759require_once ABSPATH . 'wp-admin/admin-header.php';
     
    169171<td><input name="mailserver_login" type="text" id="mailserver_login" value="<?php form_option( 'mailserver_login' ); ?>" class="regular-text ltr" /></td>
    170172</tr>
    171 <tr>
    172 <th scope="row"><label for="mailserver_pass"><?php _e( 'Password' ); ?></label></th>
    173 <td>
    174 <input name="mailserver_pass" type="text" id="mailserver_pass" value="<?php form_option( 'mailserver_pass' ); ?>" class="regular-text ltr" />
    175 </td>
     173<tr class="mailserver-pass-wrap">
     174    <th scope="row">
     175        <label for="mailserver_pass">
     176            <?php _e( 'Password' ); ?>
     177        </label>
     178    </th>
     179    <td>
     180        <input type="hidden" value=" " /><!-- #24364 workaround -->
     181        <span class="wp-pwd">
     182            <input type="text" name="mailserver_pass" id="mailserver_pass" class="regular-text ltr" autocomplete="off" data-reveal="1" data-pw="<?php echo esc_attr( get_option( 'mailserver_pass' ) ); ?>" />
     183            <button type="button" class="button wp-hide-pw hide-if-no-js" data-toggle="0" data-start-masked="1" aria-label="<?php esc_attr_e( 'Hide password' ); ?>">
     184                <span class="dashicons dashicons-visibility" aria-hidden="true"></span>
     185            </button>
     186        </span>
     187    </td>
    176188</tr>
    177189<tr>
Note: See TracChangeset for help on using the changeset viewer.