Ticket #42852: 42852.diff
| File 42852.diff, 13.2 KB (added by , 8 years ago) |
|---|
-
src/wp-admin/css/forms.css
443 443 vertical-align: baseline; 444 444 } 445 445 446 .wp-generate-pw + .wp-pwd { 447 margin-top: 1em; 448 } 449 446 450 #pass-strength-result { 447 451 background-color: #eee; 448 452 border: 1px solid #ddd; -
src/wp-admin/css/login.css
74 74 } 75 75 76 76 .login .password-input-wrapper { 77 display: table;77 display: table; 78 78 } 79 79 80 80 .login .input.password-input { 81 display: table-cell;82 margin: 0;81 display: table-cell; 82 margin: 0; 83 83 } 84 84 85 85 .login .pw-weak { 86 margin-bottom: 15px;86 margin-bottom: 15px; 87 87 } 88 88 89 .login .wp-hide-pw-wrapper { 90 display: table-cell; 91 vertical-align: top; 92 } 93 89 94 .login .button.button-secondary { 90 display: table-cell; 91 border-radius: 0; 92 vertical-align: middle; 95 height: 36px; 96 margin: 0; 97 border-radius: 0; 98 line-height: normal; 93 99 } 94 100 101 .login .wp-hide-pw .dashicons { 102 position: static; 103 } 104 95 105 .login form { 96 106 margin-top: 20px; 97 107 margin-left: 0; -
src/wp-admin/install.php
137 137 <?php if ( ! $user_table ) : ?> 138 138 <tr class="form-field form-required user-pass1-wrap"> 139 139 <th scope="row"> 140 <label for="pass1" >140 <label for="pass1" class="user-pass1-label"> 141 141 <?php _e( 'Password' ); ?> 142 142 </label> 143 143 </th> -
src/wp-admin/js/user-profile.js
1 1 /* global ajaxurl, pwsL10n, userProfileL10n */ 2 2 (function($) { 3 3 var updateLock = false, 4 5 4 $pass1Row, 6 5 $pass1Wrap, 7 6 $pass1, … … 14 13 $submitButtons, 15 14 $submitButton, 16 15 currentPass, 17 inputEvent; 16 inputEvent, 17 $passwordWrapper; 18 18 19 19 /* 20 20 * Use feature detection to determine whether password inputs should use … … 31 31 if ( typeof zxcvbn !== 'function' ) { 32 32 setTimeout( generatePassword, 50 ); 33 33 return; 34 } else if ( ! $pass1.val() ) {34 } else if ( ! $pass1.val() || $passwordWrapper.hasClass( 'is-open' ) ) { 35 35 // zxcvbn loaded before user entered password. 36 36 $pass1.val( $pass1.data( 'pw' ) ); 37 37 $pass1.trigger( 'pwupdate' ); 38 38 showOrHideWeakPasswordCheckbox(); 39 } 40 else { 39 } else { 41 40 // zxcvbn loaded after the user entered password, check strength. 42 41 check_pass_strength(); 43 42 showOrHideWeakPasswordCheckbox(); 44 43 } 45 44 45 // Install screen. 46 46 if ( 1 !== parseInt( $toggleButton.data( 'start-masked' ), 10 ) ) { 47 // Show the password not masked if admin_password hasn't been posted yet. 47 48 $pass1Wrap.addClass( 'show-password' ); 48 49 } else { 50 // Otherwise, mask the password. 49 51 $toggleButton.trigger( 'click' ); 50 52 } 51 53 … … 109 111 .removeClass( 'dashicons-visibility' ) 110 112 .addClass( 'dashicons-hidden' ); 111 113 112 $pass1Text.focus();113 114 114 $pass1Label.attr( 'for', 'pass1-text' ); 115 115 } 116 116 … … 121 121 $pass1Wrap.addClass( 'show-password' ); 122 122 123 123 resetToggle(); 124 125 if ( ! _.isUndefined( $pass1Text[0].setSelectionRange ) ) {126 $pass1Text[0].setSelectionRange( 0, 100 );127 }128 124 } else { 129 125 $pass1Wrap.removeClass( 'show-password' ); 130 126 $toggleButton … … 139 135 .removeClass('dashicons-hidden') 140 136 .addClass('dashicons-visibility'); 141 137 142 $pass1.focus();143 144 138 $pass1Label.attr( 'for', 'pass1' ); 145 146 if ( ! _.isUndefined( $pass1[0].setSelectionRange ) ) {147 $pass1[0].setSelectionRange( 0, 100 );148 }149 139 } 150 140 }); 151 141 } 152 142 153 143 function bindPasswordForm() { 154 var $passwordWrapper, 155 $generateButton, 144 var $generateButton, 156 145 $cancelButton; 157 146 158 147 $pass1Row = $('.user-pass1-wrap'); 159 $pass1Label = $pass1Row.find( 'th label').attr( 'for', 'pass1-text' );148 $pass1Label = $pass1Row.find( '.user-pass1-label' ).attr( 'for', 'pass1-text' ); 160 149 161 // hide this150 // Hide the Repeat Password field. 162 151 $('.user-pass2-wrap').hide(); 163 152 164 153 $submitButton = $( '#submit, #wp-submit' ).on( 'click', function () { … … 178 167 bindPass1(); 179 168 } 180 169 181 /* *170 /* 182 171 * Fix a LastPass mismatch issue, LastPass only changes pass2. 183 172 * 184 173 * This fixes the issue by copying any changes from the hidden … … 205 194 206 195 bindToggleButton(); 207 196 208 if ( $generateButton.length ) {209 $passwordWrapper.hide();210 }211 212 $generateButton.show();213 197 $generateButton.on( 'click', function () { 214 198 updateLock = true; 215 199 216 $generateButton.hide(); 217 $passwordWrapper.show(); 200 $generateButton.attr( 'aria-expanded', 'true' ); 218 201 202 $passwordWrapper 203 .show() 204 .addClass( 'is-open' ); 205 219 206 // Enable the inputs when showing. 220 207 $pass1.attr( 'disabled', false ); 221 208 $pass2.attr( 'disabled', false ); 222 209 $pass1Text.attr( 'disabled', false ); 223 210 224 if ( $pass1Text.val().length === 0 ) { 225 generatePassword(); 226 } 227 228 _.defer( function() { 229 $pass1Text.focus(); 230 if ( ! _.isUndefined( $pass1Text[0].setSelectionRange ) ) { 231 $pass1Text[0].setSelectionRange( 0, 100 ); 232 } 233 }, 0 ); 211 // Always generate a password when clicking the button. 212 // Generate a new password. 213 wp.ajax.post( 'generate-password' ) 214 .done( function( data ) { 215 $pass1.data( 'pw', data ); 216 generatePassword(); 217 resetToggle(); 218 } ); 234 219 } ); 235 220 236 221 $cancelButton = $pass1Row.find( 'button.wp-cancel-pw' ); … … 237 222 $cancelButton.on( 'click', function () { 238 223 updateLock = false; 239 224 240 // Clear any entered password.225 // Clear password field to prevent update. 241 226 $pass1Text.val( '' ); 242 243 // Generate a new password. 244 wp.ajax.post( 'generate-password' ) 245 .done( function( data ) { 246 $pass1.data( 'pw', data ); 247 } ); 248 249 $generateButton.show(); 250 $passwordWrapper.hide(); 251 252 $weakRow.hide( 0, function () { 253 $weakCheckbox.removeProp( 'checked' ); 254 } ); 255 256 // Disable the inputs when hiding to prevent autofill and submission. 257 $pass1.prop( 'disabled', true ); 258 $pass2.prop( 'disabled', true ); 259 $pass1Text.prop( 'disabled', true ); 260 261 resetToggle(); 262 263 if ( $pass1Row.closest( 'form' ).is( '#your-profile' ) ) { 264 // Clear password field to prevent update 265 $pass1.val( '' ).trigger( 'pwupdate' ); 266 $submitButtons.prop( 'disabled', false ); 267 } 227 $pass1.val( '' ).trigger( 'pwupdate' ); 268 228 } ); 269 229 270 230 $pass1Row.closest( 'form' ).on( 'submit', function () { … … 373 333 }); 374 334 }); 375 335 376 /** 377 * Replaces "Howdy, *" in the admin toolbar whenever the display name dropdown is updated for one's own profile. 336 /* 337 * Replaces "Howdy, *" in the admin toolbar whenever the display name 338 * dropdown is updated for one's own profile. 378 339 */ 379 340 select.on( 'change', function() { 380 341 if ( user_id !== current_user_id ) { … … 460 421 461 422 window.generatePassword = generatePassword; 462 423 463 / * Warn the user if password was generated but not saved */424 // Warn the user if password was generated but not saved. 464 425 $( window ).on( 'beforeunload', function () { 465 426 if ( true === updateLock ) { 466 427 return userProfileL10n.warn; -
src/wp-admin/user-edit.php
601 601 <h2><?php _e( 'Account Management' ); ?></h2> 602 602 <table class="form-table"> 603 603 <tr id="password" class="user-pass1-wrap"> 604 <th><label for="pass1" ><?php _e( 'New Password' ); ?></label></th>604 <th><label for="pass1" class="user-pass1-label"><?php _e( 'New Password' ); ?></label></th> 605 605 <td> 606 606 <input class="hidden" value=" " /><!-- #24364 workaround --> 607 <button type="button" class="button wp-generate-pw hide-if-no-js" ><?php _e( 'GeneratePassword' ); ?></button>607 <button type="button" class="button wp-generate-pw hide-if-no-js" aria-expanded="false"><?php _e( 'Set New Password' ); ?></button> 608 608 <div class="wp-pwd hide-if-js"> 609 609 <span class="password-input-wrapper"> 610 610 <input type="password" name="pass1" id="pass1" class="regular-text" value="" autocomplete="off" data-pw="<?php echo esc_attr( wp_generate_password( 24 ) ); ?>" aria-describedby="pass-strength-result" /> … … 613 613 <span class="dashicons dashicons-hidden"></span> 614 614 <span class="text"><?php _e( 'Hide' ); ?></span> 615 615 </button> 616 <button type="button" class="button wp-cancel-pw hide-if-no-js" data-toggle="0" aria-label="<?php esc_attr_e( 'Cancel password change' ); ?>">616 <button type="button" class="button wp-cancel-pw hide-if-no-js" data-toggle="0" aria-label="<?php esc_attr_e( 'Cancel' ); ?>"> 617 617 <span class="text"><?php _e( 'Cancel' ); ?></span> 618 618 </button> 619 619 <div style="display:none" id="pass-strength-result" aria-live="polite"></div> … … 623 623 <tr class="user-pass2-wrap hide-if-js"> 624 624 <th scope="row"><label for="pass2"><?php _e( 'Repeat New Password' ); ?></label></th> 625 625 <td> 626 <input name="pass2" type="password" id="pass2" class="regular-text" value="" autocomplete="off" /> 627 <p class="description"><?php _e( 'Type your new password again.' ); ?></p> 626 <input name="pass2" type="password" id="pass2" class="regular-text" value="" autocomplete="off" aria-describedby="pass2-desc" /> 627 <?php if ( IS_PROFILE_PAGE ) : ?> 628 <p class="description" id="pass2-desc"><?php _e( 'Type your new password again.' ); ?></p> 629 <?php else : ?> 630 <p class="description" id="pass2-desc"><?php _e( 'Type the new password again.' ); ?></p> 631 <?php endif; ?> 628 632 </td> 629 633 </tr> 630 634 <tr class="pw-weak"> … … 632 636 <td> 633 637 <label> 634 638 <input type="checkbox" name="pw_weak" class="pw-checkbox" /> 635 <span id="pw-weak-text-label"><?php _e( 'Confirm use of potentiallyweak password' ); ?></span>639 <span id="pw-weak-text-label"><?php _e( 'Confirm use of weak password' ); ?></span> 636 640 </label> 637 641 </td> 638 642 </tr> -
src/wp-admin/user-new.php
485 485 </tr> 486 486 <tr class="form-field form-required user-pass1-wrap"> 487 487 <th scope="row"> 488 <label for="pass1" >488 <label for="pass1" class="user-pass1-label"> 489 489 <?php _e( 'Password' ); ?> 490 490 <span class="description hide-if-js"><?php _e( '(required)' ); ?></span> 491 491 </label> … … 492 492 </th> 493 493 <td> 494 494 <input class="hidden" value=" " /><!-- #24364 workaround --> 495 <button type="button" class="button wp-generate-pw hide-if-no-js" ><?php _e( 'Show password' ); ?></button>495 <button type="button" class="button wp-generate-pw hide-if-no-js" aria-expanded="false"><?php _e( 'Set New Password' ); ?></button> 496 496 <div class="wp-pwd hide-if-js"> 497 497 <?php $initial_password = wp_generate_password( 24 ); ?> 498 498 <span class="password-input-wrapper"> … … 502 502 <span class="dashicons dashicons-hidden"></span> 503 503 <span class="text"><?php _e( 'Hide' ); ?></span> 504 504 </button> 505 <button type="button" class="button wp-cancel-pw hide-if-no-js" data-toggle="0" aria-label="<?php esc_attr_e( 'Cancel password change' ); ?>">505 <button type="button" class="button wp-cancel-pw hide-if-no-js" data-toggle="0" aria-label="<?php esc_attr_e( 'Cancel' ); ?>"> 506 506 <span class="text"><?php _e( 'Cancel' ); ?></span> 507 507 </button> 508 508 <div style="display:none" id="pass-strength-result" aria-live="polite"></div> … … 512 512 <tr class="form-field form-required user-pass2-wrap hide-if-js"> 513 513 <th scope="row"><label for="pass2"><?php _e( 'Repeat Password' ); ?> <span class="description"><?php _e( '(required)' ); ?></span></label></th> 514 514 <td> 515 <input name="pass2" type="password" id="pass2" autocomplete="off" /> 515 <input name="pass2" type="password" id="pass2" autocomplete="off" aria-describedby="pass2-desc" /> 516 <p class="description" id="pass2-desc"><?php _e( 'Type the password again.' ); ?></p> 516 517 </td> 517 518 </tr> 518 519 <tr class="pw-weak"> -
src/wp-login.php
706 706 707 707 <div class="user-pass1-wrap"> 708 708 <p> 709 <label for="pass1" ><?php _e( 'New password' ); ?></label>709 <label for="pass1" class="user-pass1-label"><?php _e( 'New password' ); ?></label> 710 710 </p> 711 711 712 <div class=" wp-pwd">712 <div class="login-wp-pwd"> 713 713 <div class="password-input-wrapper"> 714 714 <input type="password" data-reveal="1" data-pw="<?php echo esc_attr( wp_generate_password( 16 ) ); ?>" name="pass1" id="pass1" class="input password-input" size="24" value="" autocomplete="off" aria-describedby="pass-strength-result" /> 715 <span class="button button-secondary wp-hide-pw hide-if-no-js"> 716 <span class="dashicons dashicons-hidden"></span> 717 </span> 715 <span class="wp-hide-pw-wrapper"> 716 <button type="button" class="button button-secondary wp-hide-pw hide-if-no-js"> 717 <span class="dashicons dashicons-hidden"></span> 718 </button> 719 </span> 718 720 </div> 719 721 <div id="pass-strength-result" class="hide-if-no-js" aria-live="polite"><?php _e( 'Strength indicator' ); ?></div> 720 722 </div>