WordPress.org

Make WordPress Core

Changeset 31871


Ignore:
Timestamp:
03/24/2015 04:28:56 PM (6 years ago)
Author:
johnbillion
Message:

Implement an aria-describedby attribute for login screen errors, and improve the "Forgot password?" anchor text.

Props aferica, rianrietveld
Fixes #31143

Location:
trunk/src
Files:
2 edited

Legend:

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

    r31669 r31871  
    135135
    136136    if ( !$user )
    137         return new WP_Error( 'invalid_username', sprintf( __( '<strong>ERROR</strong>: Invalid username. <a href="%s">Lost your password</a>?' ), wp_lostpassword_url() ) );
     137        return new WP_Error( 'invalid_username', sprintf( __( '<strong>ERROR</strong>: Invalid username. <a href="%s">Lost your password?</a>' ), wp_lostpassword_url() ) );
    138138
    139139    /**
     
    151151
    152152    if ( !wp_check_password($password, $user->user_pass, $user->ID) )
    153         return new WP_Error( 'incorrect_password', sprintf( __( '<strong>ERROR</strong>: The password you entered for the username <strong>%1$s</strong> is incorrect. <a href="%2$s">Lost your password</a>?' ),
     153        return new WP_Error( 'incorrect_password', sprintf( __( '<strong>ERROR</strong>: The password you entered for the username <strong>%1$s</strong> is incorrect. <a href="%2$s">Lost your password?</a>' ),
    154154        $username, wp_lostpassword_url() ) );
    155155
  • trunk/src/wp-login.php

    r31417 r31871  
    890890        $user_login = ( 'incorrect_password' == $errors->get_error_code() || 'empty_password' == $errors->get_error_code() ) ? esc_attr(wp_unslash($_POST['log'])) : '';
    891891    $rememberme = ! empty( $_POST['rememberme'] );
     892
     893    if ( ! empty( $errors->errors ) ) {
     894        $aria_describedby_error = ' aria-describedby="login_error"';
     895    } else {
     896        $aria_describedby_error = '';
     897    }
    892898?>
    893899
     
    895901    <p>
    896902        <label for="user_login"><?php _e('Username') ?><br />
    897         <input type="text" name="log" id="user_login" class="input" value="<?php echo esc_attr($user_login); ?>" size="20" /></label>
     903        <input type="text" name="log" id="user_login"<?php echo $aria_describedby_error; ?> class="input" value="<?php echo esc_attr( $user_login ); ?>" size="20" /></label>
    898904    </p>
    899905    <p>
    900906        <label for="user_pass"><?php _e('Password') ?><br />
    901         <input type="password" name="pwd" id="user_pass" class="input" value="" size="20" /></label>
     907        <input type="password" name="pwd" id="user_pass"<?php echo $aria_describedby_error; ?> class="input" value="" size="20" /></label>
    902908    </p>
    903909    <?php
Note: See TracChangeset for help on using the changeset viewer.