[wp-trac] [WordPress Trac] #42377: login screen empty fields msgs are not in sync with the "Username or Email Address" field label

WordPress Trac noreply at wordpress.org
Mon Oct 30 08:59:30 UTC 2017


#42377: login screen empty fields msgs are not in sync with the "Username or Email
Address" field label
------------------------------------+-----------------------------
 Reporter:  nlpro                   |      Owner:
     Type:  defect (bug)            |     Status:  new
 Priority:  normal                  |  Milestone:  Awaiting Review
Component:  Login and Registration  |    Version:  4.8.2
 Severity:  normal                  |   Keywords:
  Focuses:  ui                      |
------------------------------------+-----------------------------
 (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.

 2. 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.

 3. 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.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/42377>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list