Passwords: Disable hidden input fields on profile/user edit page.
Prevents an issue where password helpers would autofill the hidden password fields and inadvertently causing password changes when editing other fields on the profile page. Props adamsilverstein. Fixes #33699. git-svn-id: https://develop.svn.wordpress.org/trunk@35603 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
bf8e1083de
commit
66db054bae
@ -195,6 +195,11 @@
|
||||
}
|
||||
} );
|
||||
|
||||
// Disable the hidden inputs to prevent autofill and submission.
|
||||
$pass1.prop( 'disabled', true );
|
||||
$pass2.prop( 'disabled', true );
|
||||
$pass1Text.prop( 'disabled', true );
|
||||
|
||||
$passwordWrapper = $pass1Row.find( '.wp-pwd' );
|
||||
$generateButton = $pass1Row.find( 'button.wp-generate-pw' );
|
||||
|
||||
@ -211,6 +216,11 @@
|
||||
$generateButton.hide();
|
||||
$passwordWrapper.show();
|
||||
|
||||
// Enable the inputs when showing.
|
||||
$pass1.attr( 'disabled', false );
|
||||
$pass2.attr( 'disabled', false );
|
||||
$pass1Text.attr( 'disabled', false );
|
||||
|
||||
if ( $pass1Text.val().length === 0 ) {
|
||||
generatePassword();
|
||||
}
|
||||
@ -239,6 +249,11 @@
|
||||
$generateButton.show();
|
||||
$passwordWrapper.hide();
|
||||
|
||||
// Disable the inputs when hiding to prevent autofill and submission.
|
||||
$pass1.prop( 'disabled', true );
|
||||
$pass2.prop( 'disabled', true );
|
||||
$pass1Text.prop( 'disabled', true );
|
||||
|
||||
resetToggle();
|
||||
|
||||
// Clear password field to prevent update
|
||||
|
Loading…
Reference in New Issue
Block a user