From 96b4b1a70db55af55dfbc8b1dc6febbddd07deb9 Mon Sep 17 00:00:00 2001 From: Adam Silverstein Date: Fri, 13 Sep 2019 18:29:29 +0000 Subject: [PATCH] Login and Registration: reset password - ensure submit button disabled when field empty. Fix an issue where the submit button was enabled with an empty password when the user previously checked "Confirm use of weak password" for a weak password, then cleared the password field. Props henry.wright. Fixes #47924. git-svn-id: https://develop.svn.wordpress.org/trunk@46103 602fd350-edb4-49c9-b593-d223f7449a82 --- src/js/_enqueues/admin/user-profile.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/js/_enqueues/admin/user-profile.js b/src/js/_enqueues/admin/user-profile.js index 386f8ae593..c34b9284d1 100644 --- a/src/js/_enqueues/admin/user-profile.js +++ b/src/js/_enqueues/admin/user-profile.js @@ -272,9 +272,9 @@ function check_pass_strength() { var pass1 = $('#pass1').val(), strength; - $('#pass-strength-result').removeClass('short bad good strong'); + $('#pass-strength-result').removeClass('short bad good strong empty'); if ( ! pass1 ) { - $('#pass-strength-result').html( ' ' ); + $( '#pass-strength-result' ).addClass( 'empty' ).html( ' ' ); return; } @@ -312,7 +312,12 @@ } $weakRow.show(); } else { - $submitButtons.prop( 'disabled', false ); + if ( $( passStrength ).is( '.empty' ) ) { + $submitButtons.prop( 'disabled', true ); + $weakCheckbox.prop( 'checked', false ); + } else { + $submitButtons.prop( 'disabled', false ); + } $weakRow.hide(); } }