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

[6.x] Fix authenticating existing users if the underlying users email has been changed #351

Merged
merged 6 commits into from
Mar 27, 2024

Conversation

joelbutcher
Copy link
Owner

@joelbutcher joelbutcher commented Mar 27, 2024

Resolves #350

This PR makes a few changes to the authentication flow & responses:

  1. Updates the canRegister method to check $user and $account values. If either of these are NOT null it returns false, instructing us to attempt to authenticate the existing user.
  2. If we cannot find a user for the email on the provider, we now resolve the user from the connected account model, if one exists for the provider.
  3. Added a new test to ensure users who change their emails can still be logged in with previous providers
  4. Deprecated some response contracts and classes in favour of a more generic OAuthFailed event and OAuthFailedResponse.
  5. Replaces all usages of session() with Session facade

@joelbutcher
Copy link
Owner Author

\cc. @mystyq – this should fix the problems you're having

@joelbutcher joelbutcher changed the title [6.x] Fix authentication existing users if the underlying users email has been changed [6.x] Fix authenticating existing users if the underlying users email has been changed Mar 27, 2024
@mystyq
Copy link

mystyq commented Mar 27, 2024

@joelbutcher Yes, this fixes resolving the correct account. Thank you.

@joelbutcher joelbutcher merged commit ac8b8c9 into 6.x Mar 27, 2024
41 checks passed
@joelbutcher joelbutcher deleted the bugfix/profile-email-changed-auth branch March 27, 2024 15:37
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

Successfully merging this pull request may close these issues.

Fixes - Changing email after signing in with a connected account renders account not accessible
2 participants