mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-22 09:07:59 +01:00
Application Passwords: Add copy button when adding new password.
Props circlecube, dhruvang21, ironprogrammer, desrosj. Fixes #62019. Built from https://develop.svn.wordpress.org/trunk@59046 git-svn-id: http://core.svn.wordpress.org/trunk@58442 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
c9c2f41ab4
commit
3c85d540d4
@ -917,6 +917,11 @@ a#remove-post-thumbnail:hover,
|
||||
border: none;
|
||||
}
|
||||
|
||||
.application-password-display .success {
|
||||
color: #007017;
|
||||
margin-right: 0.5rem;
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
3.0 - Actions
|
||||
------------------------------------------------------------------------------*/
|
||||
|
2
wp-admin/css/common-rtl.min.css
vendored
2
wp-admin/css/common-rtl.min.css
vendored
File diff suppressed because one or more lines are too long
@ -916,6 +916,11 @@ a#remove-post-thumbnail:hover,
|
||||
border: none;
|
||||
}
|
||||
|
||||
.application-password-display .success {
|
||||
color: #007017;
|
||||
margin-left: 0.5rem;
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
3.0 - Actions
|
||||
------------------------------------------------------------------------------*/
|
||||
|
2
wp-admin/css/common.min.css
vendored
2
wp-admin/css/common.min.css
vendored
File diff suppressed because one or more lines are too long
@ -1003,6 +1003,7 @@ table.form-table td .updated p {
|
||||
}
|
||||
|
||||
.application-password-display input.code {
|
||||
margin-bottom: 6px;
|
||||
width: 19em;
|
||||
}
|
||||
|
||||
|
2
wp-admin/css/forms-rtl.min.css
vendored
2
wp-admin/css/forms-rtl.min.css
vendored
File diff suppressed because one or more lines are too long
@ -1002,6 +1002,7 @@ table.form-table td .updated p {
|
||||
}
|
||||
|
||||
.application-password-display input.code {
|
||||
margin-bottom: 6px;
|
||||
width: 19em;
|
||||
}
|
||||
|
||||
|
2
wp-admin/css/forms.min.css
vendored
2
wp-admin/css/forms.min.css
vendored
File diff suppressed because one or more lines are too long
@ -2,11 +2,12 @@
|
||||
* @output wp-admin/js/user-profile.js
|
||||
*/
|
||||
|
||||
/* global ajaxurl, pwsL10n, userProfileL10n */
|
||||
/* global ajaxurl, pwsL10n, userProfileL10n, ClipboardJS */
|
||||
(function($) {
|
||||
var updateLock = false,
|
||||
isSubmitting = false,
|
||||
__ = wp.i18n.__,
|
||||
clipboard = new ClipboardJS( '.application-password-display .copy-button' ),
|
||||
$pass1Row,
|
||||
$pass1,
|
||||
$pass2,
|
||||
@ -18,7 +19,8 @@
|
||||
currentPass,
|
||||
$form,
|
||||
originalFormContent,
|
||||
$passwordWrapper;
|
||||
$passwordWrapper,
|
||||
successTimeout;
|
||||
|
||||
function generatePassword() {
|
||||
if ( typeof zxcvbn !== 'function' ) {
|
||||
@ -346,6 +348,27 @@
|
||||
}
|
||||
}
|
||||
|
||||
// Debug information copy section.
|
||||
clipboard.on( 'success', function( e ) {
|
||||
var triggerElement = $( e.trigger ),
|
||||
successElement = $( '.success', triggerElement.closest( '.application-password-display' ) );
|
||||
|
||||
// Clear the selection and move focus back to the trigger.
|
||||
e.clearSelection();
|
||||
|
||||
// Show success visual feedback.
|
||||
clearTimeout( successTimeout );
|
||||
successElement.removeClass( 'hidden' );
|
||||
|
||||
// Hide success visual feedback after 3 seconds since last success.
|
||||
successTimeout = setTimeout( function() {
|
||||
successElement.addClass( 'hidden' );
|
||||
}, 3000 );
|
||||
|
||||
// Handle success audible feedback.
|
||||
wp.a11y.speak( __( 'Application password has been copied to your clipboard.' ) );
|
||||
} );
|
||||
|
||||
$( function() {
|
||||
var $colorpicker, $stylesheet, user_id, current_user_id,
|
||||
select = $( '#display_name' ),
|
||||
|
2
wp-admin/js/user-profile.min.js
vendored
2
wp-admin/js/user-profile.min.js
vendored
File diff suppressed because one or more lines are too long
@ -984,6 +984,8 @@ switch ( $action ) {
|
||||
?>
|
||||
</label>
|
||||
<input id="new-application-password-value" type="text" class="code" readonly="readonly" value="{{ data.password }}" />
|
||||
<button type="button" class="button copy-button" data-clipboard-text="{{ data.password }}"><?php _e( 'Copy' ); ?></button>
|
||||
<span class="success hidden" aria-hidden="true"><?php _e( 'Copied!' ); ?></span>
|
||||
</p>
|
||||
<p><?php _e( 'Be sure to save this in a safe location. You will not be able to retrieve it.' ); ?></p>
|
||||
<button type="button" class="notice-dismiss">
|
||||
|
@ -1213,7 +1213,7 @@ function wp_default_scripts( $scripts ) {
|
||||
$scripts->add( 'auth-app', "/wp-admin/js/auth-app$suffix.js", array( 'jquery', 'wp-api-request', 'wp-i18n', 'wp-hooks' ), false, 1 );
|
||||
$scripts->set_translations( 'auth-app' );
|
||||
|
||||
$scripts->add( 'user-profile', "/wp-admin/js/user-profile$suffix.js", array( 'jquery', 'password-strength-meter', 'wp-util' ), false, 1 );
|
||||
$scripts->add( 'user-profile', "/wp-admin/js/user-profile$suffix.js", array( 'clipboard', 'jquery', 'password-strength-meter', 'wp-util', 'wp-a11y' ), false, 1 );
|
||||
$scripts->set_translations( 'user-profile' );
|
||||
$user_id = isset( $_GET['user_id'] ) ? (int) $_GET['user_id'] : 0;
|
||||
did_action( 'init' ) && $scripts->localize(
|
||||
|
@ -16,7 +16,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '6.7-alpha-59045';
|
||||
$wp_version = '6.7-alpha-59046';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
Loading…
Reference in New Issue
Block a user