Opened 6 years ago
Last modified 8 months ago
#52256 reopened defect (bug)
Default hide password field.
| Reported by: | dilipbheda | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Awaiting Review |
| Component: | Users | Version: | 5.6 |
| Severity: | normal | Keywords: | has-patch dev-feedback |
| Cc: | Focuses: | javascript, administration |
Description
Generate password not working when the first click on generate password button.
Check different behavior in the below URLs
{siteurl}/wp-admin/user-new.php
{siteurl}/wp-admin/profile.php
{siteurl}/wp-admin/user-edit.php?user_id={user_id}
Check the video for a better understanding.
https://www.loom.com/share/2b91de25ab1447e3bb069738c0d318b8
Attachments (2)
Change History (7)
#1
@
6 years ago
- Component Users → Administration
- Resolution → invalid
- Status new → closed
- Version trunk → 5.6
#2
@
6 years ago
- Keywords dev-feedback needs-testing added
- Resolution invalid
- Status closed → reopened
#5
@
8 months ago
- Keywords needs-testing removed
Patch Testing Report
Patch Tested: https://core.trac.wordpress.org/attachment/ticket/52256/52256.patch
Environment
- WordPress: 7.0-alpha-61215-src
- PHP: 8.2.29
- Server: nginx/1.29.4
- Database: mysqli (Server: 8.4.7 / Client: mysqlnd 8.2.29)
- Browser: Chrome 144.0.0.0
- OS: macOS
- Theme: Twenty Twenty-One 2.7
- MU Plugins: None activated
- Plugins:
- Test Reports 1.2.1
Steps taken
- Navigate to Users > Add User
- Click Generate Password button once
- Observe the password does not change
- Observe that subsequent clicks cause new passwords to be generated
- Apply patch
- Navigate to Users > Add User
- Password field is now not visible by default
- Each click to Generate Password button now generates a new password
- ✅ Patch is solving the problem.
Expected result
- We are expecting Generate Password button to work from the initial click.
Screenshots/Screencast with results
Video before patch: https://files.catbox.moe/8imt1z.mp4
Video after patch: https://files.catbox.moe/0xiz93.mp4
Note:
See TracTickets
for help on using tickets.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Hello ! I have solved this bug.
To fix this bug paste code below from codesandbox into \wp-admin\js\user-profile.min.js folder
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) :
If it helps you , please reaply)