Authentication: Allow users to log in using their email address.

Introduces `wp_authenticate_email_password()` which is hooked into `authenticate` after `wp_authenticate_username_password()`.

Props Denis-de-Bernardy, ericlewis, vhomenko, MikeHansenMe, swissspidy, ocean90.
Fixes #9568.

git-svn-id: https://develop.svn.wordpress.org/trunk@36617 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Dominik Schilling (ocean90)
2016-02-22 23:14:27 +00:00
parent cde3d4c399
commit 12cf07c669
5 changed files with 101 additions and 5 deletions

View File

@@ -548,7 +548,7 @@ if ( !function_exists('wp_authenticate') ) :
*
* @since 2.5.0
*
* @param string $username User's username.
* @param string $username User's username or email address.
* @param string $password User's password.
* @return WP_User|WP_Error WP_User object if the credentials are valid,
* otherwise WP_Error.
@@ -575,7 +575,7 @@ function wp_authenticate($username, $password) {
if ( $user == null ) {
// TODO what should the error message be? (Or would these even happen?)
// Only needed if all authentication handlers fail to return anything.
$user = new WP_Error('authentication_failed', __('<strong>ERROR</strong>: Invalid username or incorrect password.'));
$user = new WP_Error( 'authentication_failed', __( '<strong>ERROR</strong>: Invalid username, email address or incorrect password.' ) );
}
$ignore_codes = array('empty_username', 'empty_password');