WordPress.org

Make WordPress Core

Opened 6 weeks ago

Closed 6 weeks ago

#52914 closed defect (bug) (fixed)

Inconsistent error message format on login

Reported by: dd32 Owned by: SergeyBiryukov
Milestone: 5.8 Priority: normal
Severity: normal Version:
Component: Login and Registration Keywords:
Focuses: ui-copy Cc:

Description

The WordPress login screen is inconsistent in it's error messaging, using two different forms of textual error messages.

The formatting is mostly related to [48059] which removed the <strong>Error:</strong> prefix from a few login related errors, but didn't remove it from the authentication handlers and other areas of wp-login.php. As a result, you can receive two different formats of errors.

See the below attachment for an example of the mixed error message style.

Here's a list of most of the error messages related to authentication/registration

wp-login.php
__( 'Your password reset link appears to be invalid. Please request a new link below.' )
__( 'Your password reset link has expired. Please request a new link below.' )
__( 'The passwords do not match.' )
__( '<strong>Error</strong>: Cookies are blocked due to unexpected output. For help, please see <a href="%1$s">this documentation</a> or try the <a href="%2$s">support forums</a>.' ),
__( '<strong>Error</strong>: Cookies are blocked or not supported by your browser. You must <a href="%s">enable cookies</a> to use WordPress.' ),
__( 'Your session has expired. Please log in to continue where you left off.' ), 'message' );
__( 'You are now logged out.' ), 'message' );
__( 'User registration is currently not allowed.' ) );
__( '<strong>You have successfully updated WordPress!</strong> Please log back in to see what&#8217;s new.' ), 'message' );
__( 'Recovery Mode Initialized. Please log in to continue.' ), 'message' );

wp-includes/pluggable.php
__( '<strong>Error</strong>: Invalid username, email address or incorrect password.' ) );

wp-includes/user.php
__( '<strong>Error</strong>: The username field is empty.' ) );
__( '<strong>Error</strong>: The password field is empty.' ) );
__( '<strong>Error</strong>: The password you entered for the username %s is incorrect.' ),
__( '<strong>Error</strong>: The email field is empty.' ) );
__( '<strong>Error</strong>: The password field is empty.' ) );
__( '<strong>Error</strong>: The password you entered for the email address %s is incorrect.' ),
__( '<strong>Error</strong>: Your account has been marked as a spammer.' ) );
__( '<strong>Error</strong>: There is no account with that username or email address.' ) );
__( '<strong>Error</strong>: Please enter a username or email address.' ) );
__( '<strong>Error</strong>: There is no account with that username or email address.' ) );
__( '<strong>Error</strong>: There is no account with that username or email address.' ) );
__( '<strong>Error</strong>: The email could not be sent. Your site may not be correctly configured to send emails. <a href="%s">Get support for resetting your password</a>.' ),
__( '<strong>Error</strong>: Please enter a username.' ) );
__( '<strong>Error</strong>: This username is invalid because it uses illegal characters. Please enter a valid username.' ) );
__( '<strong>Error</strong>: This username is already registered. Please choose another one.' ) );
__( '<strong>Error</strong>: Sorry, that username is not allowed.' ) );
__( '<strong>Error</strong>: Please type your email address.' ) );
__( '<strong>Error</strong>: The email address isn&#8217;t correct.' ) );
__( '<strong>Error</strong>: This email is already registered. Please choose another one.' ) );
__( '<strong>Error</strong>: Couldn&#8217;t register you&hellip; please contact the <a href="mailto:%s">site admin</a>!' ),
__( '<strong>Error</strong>: The email address isn&#8217;t correct.' ),
__( '<strong>Error</strong>: The email address is already used.' ),

Attachments (1)

Screen Shot 2021-03-26 at 12.33.22 pm.png (434.5 KB) - added by dd32 6 weeks ago.

Download all attachments as: .zip

Change History (5)

#1 @sabernhardt
6 weeks ago

See also #50442 for consistent prefixes. ([48115] restored any prefixes removed in [48059].)

#2 in reply to: ↑ description @SergeyBiryukov
6 weeks ago

  • Milestone changed from Awaiting Review to 5.8
  • Owner set to SergeyBiryukov
  • Status changed from new to accepted

Replying to dd32:

The formatting is mostly related to [48059] which removed the <strong>Error:</strong> prefix from a few login related errors, but didn't remove it from the authentication handlers and other areas of wp-login.php. As a result, you can receive two different formats of errors.

As noted above, [48115] restored any prefixes removed in [48059], so the inconsistencies were likely pre-existing.

Some strings appear to be introduced or adjusted in [2438], [15710], [25696], [33019], [33034].

At a glance, it seems like these four strings should get an "Error:" prefix:

  • __( 'Your password reset link appears to be invalid. Please request a new link below.' )
  • __( 'Your password reset link has expired. Please request a new link below.' )
  • __( 'The passwords do not match.' )
  • __( 'User registration is currently not allowed.' ) );

These, on the other hand, seem more like informational messages and probably don't need the prefix:

  • __( 'Your session has expired. Please log in to continue where you left off.' ), 'message' );
  • __( 'You are now logged out.' ), 'message' );
  • __( 'Recovery Mode Initialized. Please log in to continue.' ), 'message' );
Last edited 6 weeks ago by SergeyBiryukov (previous) (diff)

#3 @SergeyBiryukov
6 weeks ago

In 50589:

Login and Registration: Restore the "Error:" prefix for the "Unknown username" message.

This makes the message more consistent with other error messages related to authentication and registration.

Follow-up to [46417].

Props dd32.
See #52914, #52915.

#4 @SergeyBiryukov
6 weeks ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In 50611:

Login and Registration: Add the "Error:" prefix to some password reset messages.

This makes the messages more consistent with other error messages related to authentication and registration.

Follow-up to [50589].

Props dd32.
Fixes #52914.

Note: See TracTickets for help on using tickets.