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

Update Email Action does not properly update username if username=email is active #16679

Closed
2 tasks done
sonOfRa opened this issue Jan 27, 2023 · 1 comment
Closed
2 tasks done
Labels
area/authentication Indicates an issue on Authentication area kind/bug Categorizes a PR related to a bug
Milestone

Comments

@sonOfRa
Copy link
Contributor

sonOfRa commented Jan 27, 2023

Before reporting an issue

  • I have searched existing issues
  • I have reproduced the issue with the latest release

Area

user-profile

Describe the bug

When a realm has the username=email flag active, and a user has to complete the update-email action, their username is not updated.

The user is then able to log in with both their old email as well as their new email.

Whether or not the realm has the "Verify Email" flag active does not impact this behaviour.

Version

20.0.3

Expected behavior

The user's username should also be set to their newly set email address.

Actual behavior

The user's username remains as the old email, which allows them to still log in with the old email, as well as disallowing new users to be created with that email address.

How to Reproduce?

  1. Launch Keycloak 20.0.3 with features=update-email
  2. Create a new realm
    2.1 Enable Email as username
    2.2 Enable Login with email
    2.3 Enable Edit username
    2.4 Enable the Update Email Required Action
  3. Create a new user
    3.1 Set a password for the user
    3.2 Set the "update email" action for the user
  4. Login to the account console as that user
  5. Enter a new email address for the user
  6. Observe that the email is changed, but the username is not

Anything else?

In the admin console, it is now visible that the user has their old email as a username, but the new email as an email. When the user is then saved (for example by going to the Attributes Tab, and pressing "Save" without changing any attributes), the user's username will actually be overwritten by the newly set email.

@sonOfRa sonOfRa added kind/bug Categorizes a PR related to a bug status/triage labels Jan 27, 2023
@ghost ghost added the area/authentication Indicates an issue on Authentication area label Jan 27, 2023
@sonOfRa
Copy link
Contributor Author

sonOfRa commented Jan 30, 2023

This is actually fixed by #15583. For some reason I thought this was included in 20.0.3, so I opened it as a new issue. Cherry-picking the change from the editUsernameCondition method makes the update email action work as expected.

@sonOfRa sonOfRa closed this as completed Jan 30, 2023
@ghost ghost removed the status/triage label Jan 30, 2023
@stianst stianst added this to the 21.0.0 milestone Feb 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/authentication Indicates an issue on Authentication area kind/bug Categorizes a PR related to a bug
Projects
None yet
Development

No branches or pull requests

2 participants