Upgrade/Install/Users: Prevent JS bug filling new passwords.

A JavaScript race condition was throwing an error and preventing passwords from being set if the zxcvbn library loaded earlier than expected. This could prevent the installation of WordPress or the creation/updating of user accounts.

Props adi64bit, afragen, agepcom, audrasjb, bedas, brookedot, cbigler, charlyox, costdev, desrosj, drago239, Eric3D, espiat, jadpm, jrf, justinahinon, kubiq, lkraav, michelangelovandam, mirkolofio, mkox, peterwilsoncc, poena, sbossarte, sebastienserre, SergeyBiryukov, Synchro, thomasplevy, walbo, waterfire, wpmakenorg.
Fixes #53974, #52086.

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


git-svn-id: http://core.svn.wordpress.org/trunk@52711 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Peter Wilson 2022-04-11 04:29:04 +00:00
parent 5c07bc0b59
commit bdd42a3e74
3 changed files with 13 additions and 2 deletions

View File

@ -32,6 +32,13 @@
showOrHideWeakPasswordCheckbox();
}
/*
* This works around a race condition when zxcvbn loads quickly and
* causes `generatePassword()` to run prior to the toggle button being
* bound.
*/
bindToggleButton();
// Install screen.
if ( 1 !== parseInt( $toggleButton.data( 'start-masked' ), 10 ) ) {
// Show the password not masked if admin_password hasn't been posted yet.
@ -82,6 +89,10 @@
}
function bindToggleButton() {
if ( !! $toggleButton ) {
// Do not rebind.
return;
}
$toggleButton = $pass1Row.find('.wp-hide-pw');
$toggleButton.show().on( 'click', function () {
if ( 'password' === $pass1.attr( 'type' ) ) {

File diff suppressed because one or more lines are too long

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.0-alpha-53121';
$wp_version = '6.0-alpha-53122';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.