Profile: when clicking "Cancel" after clicking "Generate Password", request and generate a new password to present to the user.

Props adamsilverstein, wonderboymusic.
Fixes #33450.

Built from https://develop.svn.wordpress.org/trunk@34312


git-svn-id: http://core.svn.wordpress.org/trunk@34276 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Scott Taylor 2015-09-18 20:14:24 +00:00
parent abefb963e7
commit c43f72fbfb
5 changed files with 21 additions and 3 deletions

View File

@ -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

View File

@ -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 ) );
}

View File

@ -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();

File diff suppressed because one or more lines are too long

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.4-alpha-34311';
$wp_version = '4.4-alpha-34312';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.