Make WordPress Core

Opened 7 years ago

#42377 new defect (bug)

login screen empty fields msgs are not in sync with the "Username or Email Address" field label

Reported by: nlpro's profile nlpro Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.8.2
Component: Login and Registration Keywords:
Focuses: ui Cc:

Description

(My first trac bug report everrrrr ...)

Recently the "Username" field label on the login screen (and other places) changed to "Username or Email Address" and users can now be authenticated using either a username or an email address.

Authentication by username is default implemented by means of a callback (wp_authenticate_username_password) hooked to the authenticate filter.
Authentication by email address is default implemented by means of an additional callback (wp_authenticate_email_password) hooked to the authenticate filter.

Implementation seems to be a bit sloppy and it doesn't provide much flexibility.

This bug report will concentrate on flexibility in the empty field error msgs displayed when the "Username or Email Address" field is left empty (while providing input for the "Password" field).

Below I'll describe 3 login situations and the resulting (mostly incorrect) error msgs followed by what I think are the correct error msgs.

Note that the "Username or Email Address" field is intentionally left unchanged for convenience. This bug report is not about changing the field label as displayed in the login screen. WordPress core as is provides enough flexibility to do that.

So here we go.

  1. Both default authentication methods are hooked to the authenticate filter.

On submitting an empty "Username or Email Address" field while providing a password the following msg is displayed:

ERROR: The username field is empty. (<== wrong)

ERROR: The Username or Email Address field is empty.

  1. Only the wp_authenticate_username_password method is hooked to the authenticate filter.

On submitting an empty "Username or Email Address" field while providing a password the following msg is displayed:

ERROR: The username field is empty. (<== actually correct)

ERROR: The Username field is empty.

  1. Only the wp_authenticate_email_password method is hooked to the authenticate filter.

On submitting an empty "Username or Email Address" field while providing a password the following msg is displayed:

ERROR: The email field is empty. (<== wrong)

ERROR: The Email Address field is empty.

Since I prefer an error msg where the field label name stands out I've capitalized the field name as well as displayed them in bold. Also helps in reading the error msgs and see the differences.

As can be seen we have an issue here. We can't always seem to get the proper field label reference in the empty field error msgs when submitting an empty "Username or Email Address" field.

There must be a way for the methods to refer to their own field label part (Username/Email Address) when individually hooked to the authenticate filter but when both are hooked at the same time refer to the combined field label (Username or Email Address) in the error msg.

I think the program logic needs to be changed so all three situations return the correct empty field error msg on login screen submit.

Change History (0)

Note: See TracTickets for help on using tickets.