Login: Move the "Lost your password?" link into a separate string to reduce HTML tags in translation strings.

Props ramiy.
Fixes #31870.
Built from https://develop.svn.wordpress.org/trunk@34354


git-svn-id: http://core.svn.wordpress.org/trunk@34318 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Dominik Schilling 2015-09-20 09:11:24 +00:00
parent 707f0d9108
commit d2414cbd2f
2 changed files with 21 additions and 6 deletions

View File

@ -136,8 +136,14 @@ function wp_authenticate_username_password($user, $username, $password) {
$user = get_user_by('login', $username); $user = get_user_by('login', $username);
if ( !$user ) if ( !$user ) {
return new WP_Error( 'invalid_username', sprintf( __( '<strong>ERROR</strong>: Invalid username. <a href="%s">Lost your password?</a>' ), wp_lostpassword_url() ) ); return new WP_Error( 'invalid_username',
__( '<strong>ERROR</strong>: Invalid username.' ) .
' <a href="' . wp_lostpassword_url() . '">' .
__( 'Lost your password?' ) .
'</a>'
);
}
/** /**
* Filter whether the given user can be authenticated with the provided $password. * Filter whether the given user can be authenticated with the provided $password.
@ -152,9 +158,18 @@ function wp_authenticate_username_password($user, $username, $password) {
if ( is_wp_error($user) ) if ( is_wp_error($user) )
return $user; return $user;
if ( !wp_check_password($password, $user->user_pass, $user->ID) ) if ( ! wp_check_password( $password, $user->user_pass, $user->ID ) ) {
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>' ), return new WP_Error( 'incorrect_password',
$username, wp_lostpassword_url() ) ); sprintf(
/* translators: %s: user name */
__( '<strong>ERROR</strong>: The password you entered for the username %s is incorrect.' ),
'<strong>' . $username . '</strong>'
) .
' <a href="' . wp_lostpassword_url() . '">' .
__( 'Lost your password?' ) .
'</a>'
);
}
return $user; return $user;
} }

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.4-alpha-34353'; $wp_version = '4.4-alpha-34354';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.