Profile: when clicking "Generate Password", toggling visibility, then canceling, ensure that the UI resets properly for when the "Generate Password" button is clicked again.
Props umesh.nevase. Fixes #33897. git-svn-id: https://develop.svn.wordpress.org/trunk@34539 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
a160be35b1
commit
5e95cd1db5
@ -98,11 +98,7 @@
|
|||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
|
|
||||||
function bindToggleButton() {
|
function resetToggle() {
|
||||||
$toggleButton = $pass1Row.find('.wp-hide-pw');
|
|
||||||
$toggleButton.show().on( 'click', function () {
|
|
||||||
if ( 1 === parseInt( $toggleButton.data( 'toggle' ), 10 ) ) {
|
|
||||||
$pass1Wrap.addClass( 'show-password' );
|
|
||||||
$toggleButton
|
$toggleButton
|
||||||
.data( 'toggle', 0 )
|
.data( 'toggle', 0 )
|
||||||
.attr({
|
.attr({
|
||||||
@ -118,6 +114,15 @@
|
|||||||
$pass1Text.focus();
|
$pass1Text.focus();
|
||||||
|
|
||||||
$pass1Label.attr( 'for', 'pass1-text' );
|
$pass1Label.attr( 'for', 'pass1-text' );
|
||||||
|
}
|
||||||
|
|
||||||
|
function bindToggleButton() {
|
||||||
|
$toggleButton = $pass1Row.find('.wp-hide-pw');
|
||||||
|
$toggleButton.show().on( 'click', function () {
|
||||||
|
if ( 1 === parseInt( $toggleButton.data( 'toggle' ), 10 ) ) {
|
||||||
|
$pass1Wrap.addClass( 'show-password' );
|
||||||
|
|
||||||
|
resetToggle();
|
||||||
|
|
||||||
if ( ! _.isUndefined( $pass1Text[0].setSelectionRange ) ) {
|
if ( ! _.isUndefined( $pass1Text[0].setSelectionRange ) ) {
|
||||||
$pass1Text[0].setSelectionRange( 0, 100 );
|
$pass1Text[0].setSelectionRange( 0, 100 );
|
||||||
@ -234,6 +239,8 @@
|
|||||||
$generateButton.show();
|
$generateButton.show();
|
||||||
$passwordWrapper.hide();
|
$passwordWrapper.hide();
|
||||||
|
|
||||||
|
resetToggle();
|
||||||
|
|
||||||
// Clear password field to prevent update
|
// Clear password field to prevent update
|
||||||
$pass1.val( '' ).trigger( 'pwupdate' );
|
$pass1.val( '' ).trigger( 'pwupdate' );
|
||||||
$submitButtons.prop( 'disabled', false );
|
$submitButtons.prop( 'disabled', false );
|
||||||
|
Loading…
Reference in New Issue
Block a user