[wp-trac] [WordPress Trac] #62147: Revealed passwords should change back to password type when submitting the form
WordPress Trac
noreply at wordpress.org
Thu Apr 24 14:35:48 UTC 2025
#62147: Revealed passwords should change back to password type when submitting the
form
-------------------------------------+-------------------------------------
Reporter: jamieburchell | Owner: johnbillion
Type: enhancement | Status: reviewing
Priority: normal | Milestone: 6.9
Component: Login and Registration | Version:
Severity: normal | Resolution:
Keywords: good-first-bug has- | Focuses: javascript,
patch has-screenshots has- | administration
testing-info |
-------------------------------------+-------------------------------------
Comment (by logicrays):
Hello
I've reviewed Ticket and tested the patch from PR #8223. The fix ensures
that password fields revert to type="password" upon form submission,
aligning with best practices to prevent unintended autofill behavior. This
enhancement functions correctly across the login, add user, and edit user
pages.
{{{
form.addEventListener('submit', function () {
const passwordFields = form.querySelectorAll('input[type="text"][data-
pw]');
passwordFields.forEach(function (field) {
field.type = 'password';
});
});
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/62147#comment:17>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list