Make WordPress Core

Changeset 44918


Ignore:
Timestamp:
03/16/2019 03:21:25 PM (6 years ago)
Author:
afercia
Message:

Accessibility: Login: Display error messages when both the username and password fields are empty.

For accessibility and usability, if an input error is detected, the item that is in error needs to be identified and the error needs to be described to the user in text (WCAG Success Criterion 3.3.1). The login form displays an error when the username field is empty or when the password field is empty. It omits to do so when both fields are empty.

This change restores the login form behavior to the one that used to work in WordPress 2.3 (!) and displays the related error messages also when both fields are empty.

Props birgire, audrasjb.
See #8938, #5405, #3708.
Fixes #42985.

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/user.php

    r44906 r44918  
    9696
    9797    if ( is_wp_error( $user ) ) {
    98         if ( $user->get_error_codes() == array( 'empty_username', 'empty_password' ) ) {
    99             $user = new WP_Error( '', '' );
    100         }
    101 
    10298        return $user;
    10399    }
  • trunk/src/wp-login.php

    r44899 r44918  
    10081008        }
    10091009
     1010        if ( empty( $_POST ) && $errors->get_error_codes() === array( 'empty_username', 'empty_password' ) ) {
     1011            $errors = new WP_Error( '', '' );
     1012        }
     1013
    10101014        if ( $interim_login ) {
    10111015            if ( ! $errors->has_errors() ) {
Note: See TracChangeset for help on using the changeset viewer.