WordPress.org

Make WordPress Core


Ignore:
Timestamp:
02/22/2016 11:14:27 PM (6 years ago)
Author:
ocean90
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/auth.php

    r35224 r36617  
    312312        $this->assertInstanceOf( 'WP_Error', $check );
    313313    }
     314
     315    /**
     316     * Ensure users can log in using both their username and their email address.
     317     *
     318     * @ticket 9568
     319     */
     320    function test_log_in_using_email() {
     321        $user_args = array(
     322            'user_login' => 'johndoe',
     323            'user_email' => 'mail@example.com',
     324            'user_pass'  => 'password',
     325        );
     326        $this->factory->user->create( $user_args );
     327
     328        $this->assertInstanceOf( 'WP_User', wp_authenticate( $user_args['user_email'], $user_args['user_pass'] ) );
     329        $this->assertInstanceOf( 'WP_User', wp_authenticate( $user_args['user_login'], $user_args['user_pass'] ) );
     330    }
    314331}
Note: See TracChangeset for help on using the changeset viewer.