Login with email. Closes #1872.

This commit is contained in:
Mike Jolley 2012-11-28 20:09:58 +00:00
parent 129d203ca9
commit a0bd719196
1 changed files with 12 additions and 1 deletions

View File

@ -590,7 +590,18 @@ function woocommerce_process_login() {
if ($woocommerce->error_count()==0) :
$creds = array();
$creds['user_login'] = $_POST['username'];
if ( is_email( $_POST['username'] ) ) {
$user = get_user_by( 'email', $_POST['username'] );
if ( isset( $user->user_login ) )
$creds['user_login'] = $user->user_login;
else
$creds['user_login'] = '';
} else {
$creds['user_login'] = $_POST['username'];
}
$creds['user_password'] = $_POST['password'];
$creds['remember'] = true;
$secure_cookie = is_ssl() ? true : false;