Make WordPress Core

Ticket #32886: 32886.7.diff

File 32886.7.diff, 6.3 KB (added by adamsilverstein, 10 years ago)

refresh against trunk

  • src/wp-admin/css/forms.css

     
    503503        padding-top: 8px;
    504504}
    505505
     506#pass1-text,
     507.show-password #pass1 {
     508        display: none;
     509}
     510.show-password #pass1-text
     511{
     512        display: inline-block;
     513}
     514.form-table span.description.important {
     515        font-size: 12px;
     516}
     517
    506518p.search-box {
    507519        float: right;
    508520        margin: 0;
  • src/wp-admin/css/install.css

     
    278278        direction: ltr;
    279279}
    280280
     281#pass1-text,
     282.show-password #pass1 {
     283        display: none;
     284}
    281285
     286.show-password #pass1-text
     287{
     288        display: inline-block;
     289}
     290
     291.form-table span.description.important {
     292        font-size: 12px;
     293}
     294
     295
    282296/* localization */
    283297body.rtl,
    284298.rtl textarea,
  • src/wp-admin/install.php

     
    137137                                </label>
    138138                        </th>
    139139                        <td>
    140                                 <button type="button" class="button button-secondary wp-generate-pw hide-if-no-js"><?php _e( 'Show password' ); ?></button>
    141                                 <div class="wp-pwd hide-if-js">
     140                                <div class="">
    142141                                        <?php $initial_password = wp_generate_password( 24 ); ?>
    143                                         <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" />
    144                                         <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                                        <input type="password" name="admin_password" id="pass1" class="regular-text" autocomplete="off" data-reveal="1" data-pw="<?php echo esc_attr( $initial_password ); ?>" />
     143                                        <button type="button" class="button button-secondary wp-hide-pw hide-if-no-js" data-toggle="0">
    145144                                                <span class="dashicons dashicons-visibility"></span>
    146145                                                <span class="text"><?php _e( 'Hide' ); ?></span>
    147146                                        </button>
    148                                         <div id="pass-strength-result" aria-live="polite"></div>
     147                                        <div id="pass-strength-result"></div>
    149148                                </div>
    150                                 <p><span class="description hide-if-no-js"><?php _e( 'A password reset link will be sent to you via email.' ); ?></span></p>
     149                                <p><span class="description important hide-if-no-js">
     150                                <strong><?php _e( 'Important:' )?></strong> <?php _e( 'You will need this password to log in, please store it in a secure location.' ); ?></span></p>
    151151                        </td>
    152152                </tr>
    153153                <tr class="form-field form-required user-pass2-wrap hide-if-js">
  • src/wp-admin/js/user-profile.js

     
    1 /* global ajaxurl, pwsL10n, userProfileL10n */
     1/* global ajaxurl, pwsL10n */
    22(function($){
    33        $(function(){
    44                var pw_new = $('.user-pass1-wrap'),
     
    1313                        pw_submitbtn_edit = $('#submit'),
    1414                        pw_submitbtn_new = $( '#createusersub' ),
    1515                        pw_checkbox = $('.pw-checkbox'),
    16                         pw_weak = $('.pw-weak')
    17                 ;
     16                        pw_weak = $('.pw-weak'),
     17                        // Set up a text version of the password input
     18                        newField = document.createElement( 'input');
     19                        newField.type = 'text';
    1820
     21                        var pwFieldText = $( newField );
     22
     23                if ( pw_field.length > 0 ) {
     24                        pwFieldText
     25                                .attr( {
     26                                        'id':           'pass1-text',
     27                                        'name':         'pass1-text',
     28                                        'autocomplete': 'off'
     29                                } )
     30                                .addClass( pw_field[0].className )
     31                                .data( 'pw', pw_field.data( 'pw' ) )
     32                                .val( pw_field.val() );
     33
     34                        pw_field
     35                                .wrap( '<span class="password-input-wrapper"></span>' )
     36                                .after( pwFieldText );
     37                }
     38
     39                var pwWrapper = pw_field.parent();
    1940                var generatePassword = window.generatePassword = function() {
    2041                        if ( typeof zxcvbn !== 'function' ) {
    2142                                setTimeout( generatePassword, 50 );
     
    2243                        } else {
    2344                                pw_field.val( pw_field.data( 'pw' ) );
    2445                                pw_field.trigger( 'propertychange' );
    25                                 pw_field.attr( 'type', 'text' ).focus();
    26                                 pw_field[0].setSelectionRange(100, 100);
     46                                pwWrapper.addClass( 'show-password' );
    2747                        }
    2848                };
    2949
     
    3151                pw_line.hide();
    3252                pw_togglebtn.show();
    3353                pw_generatebtn.show();
    34 
    3554                if ( pw_field.data( 'reveal' ) == 1 ) {
    3655                        generatePassword();
    3756                }
     
    3857
    3958                parentform.on('submit', function(){
    4059                        pw_field2.val( pw_field.val() );
    41                         pw_field.attr('type', 'password');
     60                        pwWrapper.removeClass( 'show-password' );
    4261                });
    4362
     63                pwFieldText.on( 'input', function(){
     64                        pw_field.val( pwFieldText.val() );
     65                        pw_field.trigger( 'propertychange' );
     66                } );
    4467
     68
    4569                pw_field.on('input propertychange', function(){
    4670                        setTimeout( function(){
    4771                                var cssClass = pw_strength.attr('class');
     72                                pwFieldText.val( pw_field.val() );
    4873                                pw_field.removeClass( 'short bad good strong' );
    4974                                if ( 'undefined' !== typeof cssClass ) {
    5075                                        pw_field.addClass( cssClass );
     
    88113                        pw_generatebtn.hide();
    89114                        pw_line.show();
    90115                        generatePassword();
     116                        _.defer( function() {
     117                                pwFieldText.focus();
     118                                if ( ! _.isUndefined( pwFieldText[0].setSelectionRange ) ) {
     119                                        pwFieldText[0].setSelectionRange( 0, 100 );
     120                                }
     121                        }, 0 );
     122
    91123                });
    92124
     125
    93126                pw_togglebtn.on( 'click', function() {
    94127                        var show = pw_togglebtn.attr( 'data-toggle' );
    95128                        if ( show == 1 ) {
    96                                 pw_field.attr( 'type', 'text' );
     129                                pwWrapper.addClass( 'show-password' );
    97130                                pw_togglebtn.attr({ 'data-toggle': 0, 'aria-label': userProfileL10n.ariaHide })
    98131                                        .find( '.text' ).text( userProfileL10n.hide )
    99132                                ;
     133                                pwFieldText.focus();
     134                                if ( ! _.isUndefined( pwFieldText[0].setSelectionRange ) ) {
     135                                        pwFieldText[0].setSelectionRange( 0, 100 );
     136                                }
    100137                        } else {
    101                                 pw_field.attr( 'type', 'password' );
     138                                pwWrapper.removeClass( 'show-password' );
    102139                                pw_togglebtn.attr({ 'data-toggle': 1, 'aria-label': userProfileL10n.ariaShow })
    103                                         .find( '.text' ).text( userProfileL10n.show )
    104                                 ;
     140                                        .find( '.text' ).text( userProfileL10n.show );
     141                                pw_field.focus();
     142                                if ( ! _.isUndefined( pw_field[0].setSelectionRange ) ) {
     143                                        pw_field[0].setSelectionRange( 0, 100 );
     144                                }
    105145                        }
    106                         pw_field.focus();
    107                         pw_field[0].setSelectionRange(100, 100);
     146
    108147                });
    109148        });
    110149