Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 8 additions & 18 deletions src/js/_enqueues/admin/user-profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,14 @@
if ( 'mailserver_pass' !== $pass1.prop('id' ) && ! $('#weblog_title').length ) {
$( $pass1 ).trigger( 'focus' );
}

if($( '.wp-generate-pw').length) {
// Generate the next password and cache.
wp.ajax.post( 'generate-password' )
.done( function( data ) {
$pass1.data( 'pw', data );
} );
}
}

function bindPass1() {
Expand Down Expand Up @@ -260,12 +268,6 @@

// Show generated password in plaintext by default.
resetToggle ( false );

// Generate the next password and cache.
wp.ajax.post( 'generate-password' )
.done( function( data ) {
$pass1.data( 'pw', data );
} );
} );

$cancelButton = $pass1Row.find( 'button.wp-cancel-pw' );
Expand Down Expand Up @@ -529,16 +531,4 @@
return __( 'The changes you made will be lost if you navigate away from this page.' );
}
});

/*
* We need to generate a password as soon as the Reset Password page is loaded,
* to avoid double clicking the button to retrieve the first generated password.
* See ticket #39638.
*/
$( function() {
if ( $( '.reset-pass-submit' ).length ) {
$( '.reset-pass-submit button.wp-generate-pw' ).trigger( 'click' );
}
});

})(jQuery);
Loading