Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uniqueness of WordPress user_login field #924

Open
4 tasks done
sweber83 opened this issue Feb 11, 2025 · 1 comment
Open
4 tasks done

Uniqueness of WordPress user_login field #924

sweber83 opened this issue Feb 11, 2025 · 1 comment

Comments

@sweber83
Copy link

sweber83 commented Feb 11, 2025

Checklist

  • I have looked into the Readme and the documentation, and have not found a suitable solution or answer.
  • I have searched the issues and have not found a suitable solution or answer.
  • I have searched the Auth0 Community forums and have not found a suitable solution or answer.
  • I agree to the terms within the Auth0 Code of Conduct.

Description

When a user registers/logs in for the first time, and the Authentication->onLogin() method is called, it calls Authentication->resolveIdentity() which then creates a new WordPress user.
If the users email address was already verified, the part of the email, before the @ is used as the user_login.

$username = (null !== $email) ? explode('@', $email, 2)[0] : explode('|', $sub ?? '', 2)[1];

If two users register, where the part of the email before the @ is identical, no user is created the second time (wp_create_user() returns a WP_Error instance).

What is the reason for doing it this way?
It's an obvious issue.

Reproduction

  1. Register with user [email protected]
  2. Register with user [email protected]
  3. The second user is not created because a user with the user_login "a" already exists

Additional context

No response

wp-auth0 version

5.2.1

WordPress version

6.7.1

PHP version

8.2.24

@jmossuow
Copy link

jmossuow commented Mar 4, 2025

I can confirm this issue. This was causing a no creation issue for us as well the uniqueness of this username field is fundamentally wrong. and if there is a wp error on creation there is no attempt to add like maybe a number on the end a random int and try again. Causes the user to constantly be put in loop when trying to log in. As soon as you add the user in manually they are logged in just fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants