[wp-trac] [WordPress Trac] #52256: Default hide password field.
WordPress Trac
noreply at wordpress.org
Sat Jan 9 12:28:52 UTC 2021
#52256: Default hide password field.
----------------------------+-----------------------------------------
Reporter: dilipbheda | Owner: (none)
Type: defect (bug) | Status: closed
Priority: normal | Milestone: Awaiting Review
Component: Administration | Version: 5.6
Severity: normal | Resolution: invalid
Keywords: has-patch | Focuses: javascript, administration
----------------------------+-----------------------------------------
Changes (by 9primus):
* status: new => closed
* resolution: => invalid
* version: trunk => 5.6
* component: Users => Administration
Comment:
Hello ! I have solved this bug.
To fix this bug paste code below from codesandbox into \wp-admin\js\user-
profile.min.js folder
https://codesandbox.io/s/romantic-driscoll-sws2u
I have added one condition to generatePassword function :
{{{
} else if ( ! $pass1.val() || $passwordWrapper.hasClass(
'is-open' ) ) {
// zxcvbn loaded before user entered password, or
generating new password.
let firstPassword = $pass1.data( 'pw' );
if (firstPassword){
$pass1.val(firstPassword);
$pass1.data( 'pw',"" );
}
$pass1.trigger( 'pwupdate' );
showOrHideWeakPasswordCheckbox();
}}}
and edited ajax call in $generateButton.on( 'click',... function
{{{
wp.ajax.post( 'generate-password' )
.done( function( data ) {
console.log(data);
$pass1.val( data );
} );
}}}
Your input tag for password should be like this (Path : \wp-admin\user-
new.php) :
{{{#!php
<?php
<?php $initial_password =
wp_generate_password( 24 ); ?>
<span class="password-input-wrapper">
<input type="password"
name="pass1" id="pass1" class
="regular-text" autocomplete="off"
data-reveal="1" value="" data-
pw="<?php echo esc_attr( $initial_password ); ?>"
aria-describedby="pass-strength-
result" />
</span>
}}}
If it helps you , please reaply)
--
Ticket URL: <https://core.trac.wordpress.org/ticket/52256#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list