#60062 closed defect (bug) (fixed)
Add required attribute to username and password field in wp_login_form function.
Reported by: | alesflex | Owned by: | audrasjb |
---|---|---|---|
Milestone: | 6.6 | Priority: | normal |
Severity: | normal | Version: | 3.0 |
Component: | Login and Registration | Keywords: | required-fields has-patch has-testing-info commit needs-dev-note |
Focuses: | accessibility, template | Cc: |
Description
Add required attribute to username and password field in wp_login_form function.
Change History (25)
This ticket was mentioned in Slack in #accessibility by joedolson. View the logs.
11 months ago
#3
@
11 months ago
- Keywords needs-patch added
- Type changed from enhancement to defect (bug)
- Version set to 3.0
There could be some side-effects to adding this for tools like social sign in, single sign on, etc., but it's worth exploring.
At a minimum, it should be possible to pass the required attribute to the function in the arguments array, even if they aren't added by default.
This will need some testing with extensions that include login mechanisms, particularly those that have any kind of custom bypass or handling.
This ticket was mentioned in PR #6352 on WordPress/wordpress-develop by @rcreators.
10 months ago
#6
- Keywords has-patch added; needs-patch removed
'required_username' and 'required_password' added to defaults. By default, both are set to false. So required attribute will not add to input fields. If set to true in $args for wp_login_form(), it will add the required attribute to the respective input field.
Trac ticket: https://core.trac.wordpress.org/ticket/60062
This ticket was mentioned in Slack in #accessibility by rcreators. View the logs.
10 months ago
@joedolson commented on PR #6352:
9 months ago
#8
E.g.
* @type bool $required_username Whether the username field has the 'required' attribute. Default false. * @type bool $required_password Whether the password field has the 'required' attribute. Default false.
This ticket was mentioned in Slack in #accessibility by rcreators. View the logs.
9 months ago
@rcreators commented on PR #6352:
8 months ago
#11
@joedolson Can you check and approve changes?
@rajinsharwar commented on PR #6352:
8 months ago
#12
@Rcreators Added some comments if you can review please.
@rcreators commented on PR #6352:
8 months ago
#13
@Rajinsharwar Requested changes amended.
This ticket was mentioned in Slack in #accessibility by rcreators. View the logs.
8 months ago
#15
@
8 months ago
- Keywords needs-testing has-testing-info added
Since we've decided to go with adding the arguments only, no extension testing is required. Extenders can choose to add the arguments to their implementations and test at that point. But at least it's now possible to add the required
attributes to the login form output.
Testing:
- Call
wp_login_form()
with default arguments. Confirm that the input fields are not marked as required. - Call
wp_login_form()
with therequired_username
andrequired_password
fields set to 'true'. Verify that the input fields have therequired
attribute.
#16
@
8 months ago
- Keywords needs-testing removed
I have tested the PR: 6352. And found that:
- With none of the required-x argument set: https://prnt.sc/-ez4buphF0Lv ✅
- With only 'required_password' => true: https://prnt.sc/sIwfGuvnVvpL ✅
- With only 'required_username' => true: https://prnt.sc/4D4WcIftSzKh ✅
- With both required-x set: https://prnt.sc/T24XoX0uqUsI ✅
I believe this is good to be committed.
#17
@
8 months ago
- Keywords commit added
- Owner changed from rcreators to audrasjb
- Status changed from assigned to accepted
Hi there,
Thanks for working on this. The final patch honestly results more in an enhancement than a bugfix. But as it doesn't introduce any change for extenders by default, let's mark it for commit
. Self assigning so it can ship before beta 2.
#19
@
8 months ago
- Keywords needs-dev-note added
Adding needs-dev-note
so it's mentioned in the Login and Registration devnote or in the Misc Changes devnote.
@audrasjb commented on PR #6352:
8 months ago
#20
committed in https://core.trac.wordpress.org/changeset/58382
This ticket was mentioned in Slack in #core by juanmaguitar. View the logs.
7 months ago
This ticket was mentioned in Slack in #core by joedolson. View the logs.
7 months ago
#23
@
7 months ago
Misc. dev note:
The wp_login_form()
function has two new array arguments: required_username
and required_password
. Passing true to these arguments adds the 'required' attribute to the input fields.
$args = array( 'required_username' => true, 'required_password' => true, ); wp_login_form( $args );
There is no change to the default field output.
Related: #32510