Profile: when clicking "Cancel" after clicking "Generate Password", request and generate a new password to present to the user.
Props adamsilverstein, wonderboymusic. Fixes #33450. git-svn-id: https://develop.svn.wordpress.org/trunk@34312 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
a5f62a6cd5
commit
1299974e7d
@ -62,7 +62,7 @@ $core_actions_post = array(
|
||||
'send-attachment-to-editor', 'save-attachment-order', 'heartbeat', 'get-revision-diffs',
|
||||
'save-user-color-scheme', 'update-widget', 'query-themes', 'parse-embed', 'set-attachment-thumbnail',
|
||||
'parse-media-shortcode', 'destroy-sessions', 'install-plugin', 'update-plugin', 'press-this-save-post',
|
||||
'press-this-add-category', 'crop-image',
|
||||
'press-this-add-category', 'crop-image', 'generate-password',
|
||||
);
|
||||
|
||||
// Deprecated
|
||||
|
@ -3203,3 +3203,12 @@ function wp_ajax_crop_image() {
|
||||
|
||||
wp_send_json_success( wp_prepare_attachment_for_js( $attachment_id ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Generates a password via ajax.
|
||||
*
|
||||
* @since 4.3.1
|
||||
*/
|
||||
function wp_ajax_generate_password() {
|
||||
wp_send_json_success( wp_generate_password( 24 ) );
|
||||
}
|
||||
|
@ -217,6 +217,15 @@
|
||||
$cancelButton.on( 'click', function () {
|
||||
updateLock = false;
|
||||
|
||||
// Clear any entered password.
|
||||
$pass1Text.val( '' );
|
||||
|
||||
// Generate a new password.
|
||||
wp.ajax.post( 'generate-password' )
|
||||
.done( function( data ) {
|
||||
$pass1.data( 'pw', data );
|
||||
} );
|
||||
|
||||
$generateButton.show();
|
||||
$passwordWrapper.hide();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user