From 7c5fc2debb55f5c86d1c8b150220e4d2d139d9d4 Mon Sep 17 00:00:00 2001 From: John Blackbourn Date: Tue, 24 Mar 2015 16:29:26 +0000 Subject: [PATCH] Implement an `aria-describedby` attribute for login screen errors, and improve the "Forgot password?" anchor text. Props aferica, rianrietveld Fixes #31143 Built from https://develop.svn.wordpress.org/trunk@31871 git-svn-id: http://core.svn.wordpress.org/trunk@31850 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/user.php | 4 ++-- wp-includes/version.php | 2 +- wp-login.php | 10 ++++++++-- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/wp-includes/user.php b/wp-includes/user.php index d07d54108c7..6b6f43599f1 100644 --- a/wp-includes/user.php +++ b/wp-includes/user.php @@ -134,7 +134,7 @@ function wp_authenticate_username_password($user, $username, $password) { $user = get_user_by('login', $username); if ( !$user ) - return new WP_Error( 'invalid_username', sprintf( __( 'ERROR: Invalid username. Lost your password?' ), wp_lostpassword_url() ) ); + return new WP_Error( 'invalid_username', sprintf( __( 'ERROR: Invalid username. Lost your password?' ), wp_lostpassword_url() ) ); /** * Filter whether the given user can be authenticated with the provided $password. @@ -150,7 +150,7 @@ function wp_authenticate_username_password($user, $username, $password) { return $user; if ( !wp_check_password($password, $user->user_pass, $user->ID) ) - return new WP_Error( 'incorrect_password', sprintf( __( 'ERROR: The password you entered for the username %1$s is incorrect. Lost your password?' ), + return new WP_Error( 'incorrect_password', sprintf( __( 'ERROR: The password you entered for the username %1$s is incorrect. Lost your password?' ), $username, wp_lostpassword_url() ) ); return $user; diff --git a/wp-includes/version.php b/wp-includes/version.php index 1290b11fd2a..531ec2814df 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.2-beta2-31870'; +$wp_version = '4.2-beta2-31871'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. diff --git a/wp-login.php b/wp-login.php index 62b182d4e03..9eac5ae01dc 100644 --- a/wp-login.php +++ b/wp-login.php @@ -889,16 +889,22 @@ function retrieve_password() { if ( isset($_POST['log']) ) $user_login = ( 'incorrect_password' == $errors->get_error_code() || 'empty_password' == $errors->get_error_code() ) ? esc_attr(wp_unslash($_POST['log'])) : ''; $rememberme = ! empty( $_POST['rememberme'] ); + + if ( ! empty( $errors->errors ) ) { + $aria_describedby_error = ' aria-describedby="login_error"'; + } else { + $aria_describedby_error = ''; + } ?>

+ class="input" value="" size="20" />

+ class="input" value="" size="20" />