Make WordPress Core

Changeset 53122


Ignore:
Timestamp:
04/11/2022 04:27:11 AM (3 years ago)
Author:
peterwilsoncc
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/js/_enqueues/admin/user-profile.js

    r52450 r53122  
    3333        }
    3434
     35        /*
     36         * This works around a race condition when zxcvbn loads quickly and
     37         * causes `generatePassword()` to run prior to the toggle button being
     38         * bound.
     39         */
     40        bindToggleButton();
     41
    3542        // Install screen.
    3643        if ( 1 !== parseInt( $toggleButton.data( 'start-masked' ), 10 ) ) {
     
    8390
    8491    function bindToggleButton() {
     92        if ( !! $toggleButton ) {
     93            // Do not rebind.
     94            return;
     95        }
    8596        $toggleButton = $pass1Row.find('.wp-hide-pw');
    8697        $toggleButton.show().on( 'click', function () {
Note: See TracChangeset for help on using the changeset viewer.