Skip to content

User with password containing a single quote cannot login #5089

@prometherion

Description

@prometherion

Installing WP using CLI, defining a password containing a single quote (it'sweird)

wp core install --url="http://domain.tld" \
--title="Innovative bottom-line flexibility" \
--admin_user="test.user" \
--admin_password="it'sweird" \
--admin_email="test.user@domain.tld" \
--path="/path/to/wp"
// WordPress installed successfully

Trying to login to /wp-admin with test.user / it'sweird doesn't work: so I decided to check the password using wp shell

$user = get_user_by('login', "test.user");
if ( $user && wp_check_password( "it'sweird", $user->data->user_pass, $user->ID) ) echo "seems ok";
// seems ok

After that, I decided to test with a password without single quote:

wp core install --url="http://domain.tld" \
--title="Innovative bottom-line flexibility" \
--admin_user="test.user" \
--admin_password="itsweird" \
--admin_email="test.user@domain.tld" \
--path="/path/to/wp"
// WordPress installed successfully

Checked password with wp shell: it's ok.

$user = get_user_by('login', "test.user");
if ( $user && wp_check_password( "itsweird", $user->data->user_pass, $user->ID) ) echo "seems ok";
// seems ok

Also the login using wp-admin is working as expected: editing password from UI using back it'sweird, logging out and logging in works without issue, so I suppose it's something not working with CLI...

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions