mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-07-01 15:50:09 +00:00
Lose the clunky setTimeout() code and just track the password value changes.
see #32886 git-svn-id: https://develop.svn.wordpress.org/trunk@33465 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -27,6 +27,7 @@
|
||||
|
||||
function bindPass1() {
|
||||
var passStrength = $('#pass-strength-result')[0];
|
||||
var currentPass = $pass1.val();
|
||||
|
||||
$pass1Wrap = $pass1.parent();
|
||||
|
||||
@@ -50,23 +51,26 @@
|
||||
}
|
||||
|
||||
$pass1.on( 'input propertychange', function () {
|
||||
setTimeout( function () {
|
||||
$pass1Text.val( $pass1.val() );
|
||||
$pass1.add( $pass1Text ).removeClass( 'short bad good strong' );
|
||||
if ( $pass1.val() === currentPass ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( passStrength.className ) {
|
||||
$pass1.add( $pass1Text ).addClass( passStrength.className );
|
||||
if ( 'short' === passStrength.className || 'bad' === passStrength.className ) {
|
||||
if ( ! $weakCheckbox.prop( 'checked' ) ) {
|
||||
$submitButtons.prop( 'disabled', true );
|
||||
}
|
||||
$weakRow.show();
|
||||
} else {
|
||||
$submitButtons.prop( 'disabled', false );
|
||||
$weakRow.hide();
|
||||
currentPass = $pass1.val();
|
||||
$pass1Text.val( currentPass );
|
||||
$pass1.add( $pass1Text ).removeClass( 'short bad good strong' );
|
||||
|
||||
if ( passStrength.className ) {
|
||||
$pass1.add( $pass1Text ).addClass( passStrength.className );
|
||||
if ( 'short' === passStrength.className || 'bad' === passStrength.className ) {
|
||||
if ( ! $weakCheckbox.prop( 'checked' ) ) {
|
||||
$submitButtons.prop( 'disabled', true );
|
||||
}
|
||||
$weakRow.show();
|
||||
} else {
|
||||
$submitButtons.prop( 'disabled', false );
|
||||
$weakRow.hide();
|
||||
}
|
||||
}, 1 );
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user