Changeset 59046
- Timestamp:
- 09/18/2024 12:12:52 AM (3 months ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/js/_enqueues/admin/user-profile.js
r58455 r59046 3 3 */ 4 4 5 /* global ajaxurl, pwsL10n, userProfileL10n */5 /* global ajaxurl, pwsL10n, userProfileL10n, ClipboardJS */ 6 6 (function($) { 7 7 var updateLock = false, 8 8 isSubmitting = false, 9 9 __ = wp.i18n.__, 10 clipboard = new ClipboardJS( '.application-password-display .copy-button' ), 10 11 $pass1Row, 11 12 $pass1, … … 19 20 $form, 20 21 originalFormContent, 21 $passwordWrapper; 22 $passwordWrapper, 23 successTimeout; 22 24 23 25 function generatePassword() { … … 347 349 } 348 350 351 // Debug information copy section. 352 clipboard.on( 'success', function( e ) { 353 var triggerElement = $( e.trigger ), 354 successElement = $( '.success', triggerElement.closest( '.application-password-display' ) ); 355 356 // Clear the selection and move focus back to the trigger. 357 e.clearSelection(); 358 359 // Show success visual feedback. 360 clearTimeout( successTimeout ); 361 successElement.removeClass( 'hidden' ); 362 363 // Hide success visual feedback after 3 seconds since last success. 364 successTimeout = setTimeout( function() { 365 successElement.addClass( 'hidden' ); 366 }, 3000 ); 367 368 // Handle success audible feedback. 369 wp.a11y.speak( __( 'Application password has been copied to your clipboard.' ) ); 370 } ); 371 349 372 $( function() { 350 373 var $colorpicker, $stylesheet, user_id, current_user_id, -
trunk/src/wp-admin/css/common.css
r59022 r59046 917 917 } 918 918 919 .application-password-display .success { 920 color: #007017; 921 margin-left: 0.5rem; 922 } 923 919 924 /*------------------------------------------------------------------------------ 920 925 3.0 - Actions -
trunk/src/wp-admin/css/forms.css
r58927 r59046 1003 1003 1004 1004 .application-password-display input.code { 1005 margin-bottom: 6px; 1005 1006 width: 19em; 1006 1007 } -
trunk/src/wp-admin/user-edit.php
r58820 r59046 985 985 </label> 986 986 <input id="new-application-password-value" type="text" class="code" readonly="readonly" value="{{ data.password }}" /> 987 <button type="button" class="button copy-button" data-clipboard-text="{{ data.password }}"><?php _e( 'Copy' ); ?></button> 988 <span class="success hidden" aria-hidden="true"><?php _e( 'Copied!' ); ?></span> 987 989 </p> 988 990 <p><?php _e( 'Be sure to save this in a safe location. You will not be able to retrieve it.' ); ?></p> -
trunk/src/wp-includes/script-loader.php
r59033 r59046 1214 1214 $scripts->set_translations( 'auth-app' ); 1215 1215 1216 $scripts->add( 'user-profile', "/wp-admin/js/user-profile$suffix.js", array( ' jquery', 'password-strength-meter', 'wp-util' ), false, 1 );1216 $scripts->add( 'user-profile', "/wp-admin/js/user-profile$suffix.js", array( 'clipboard', 'jquery', 'password-strength-meter', 'wp-util', 'wp-a11y' ), false, 1 ); 1217 1217 $scripts->set_translations( 'user-profile' ); 1218 1218 $user_id = isset( $_GET['user_id'] ) ? (int) $_GET['user_id'] : 0; -
trunk/tests/e2e/specs/profile/applications-passwords.test.js
r56926 r59046 32 32 successMessage 33 33 ).toContainText( 34 `Your new password for ${TEST_APPLICATION_NAME} is: \n\nBe sure to save this in a safe location. You will not be able to retrieve it.` 34 `Your new password for ${TEST_APPLICATION_NAME} is:` 35 ); 36 await expect( 37 successMessage 38 ).toContainText( 39 `Be sure to save this in a safe location. You will not be able to retrieve it.` 35 40 ); 36 41 } );
Note: See TracChangeset
for help on using the changeset viewer.