Repository navigation
Skip email sync with Auth0 when we know the update is coming from Auth0 - #831
Merged
evansims merged 2 commits intoOct 15, 2021
Merged
Conversation
Contributor
|
Hey, @drobin03 👋 Thanks very much for the PR! Give me a little to review this and I'll circle back on this with you |
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
When a user's email is updated in Auth0 and they log in on wordpress, the new email doesn't get saved to
wp_users. The code I'm modifying here is meant to save that update, and does, but it is reverted by thewp_auth0_profile_change_emailhook because it is unable to apply that change to Auth0 (due to our app not having management api access I presume).Since this particular
wp_update_usercall is always called with fresh data from the Auth0 ID token, I don't see a reason we should be attempting to sync with Auth0 afterwards. My code change here temporarily removes thewp_auth0_profile_change_emailhook to allow us to save the new email address, and then re-enables the hook after it is finished.I discovered this issue on a clients website when our Auth0 instance stopped including the email in the ID token (due to some account changes). This resulted in a number of users on our site being created with an email following this format
change_this_email@<uniqid> .cominwp_users. Once we resolved the issue with the ID token, I assumed that the next time each user logged in, their email address would be updated to the correct email from the ID token. However when I tested it, I noticed that the email change would save, and then immediately get reverted. With this fix in place locally, the email saved as-expected, and my user accounts were up-to-date.Testing