mirror of
https://github.com/discourse/discourse.git
synced 2025-06-04 20:57:23 +08:00
FIX: Allow OAuth2Authenticator to handle existing associations (#15259)
OAuth2Authenticator is considered deprecated, and isn't used in core. However, some plugins still depend on it, and this was breaking the signup of previously-staged users. There is no easy way to make an end-end test of this in core, but I will be adding an integration test in the SAML plugin.
This commit is contained in:
@ -45,13 +45,10 @@ class Auth::OAuth2Authenticator < Auth::Authenticator
|
|||||||
|
|
||||||
def after_create_account(user, auth)
|
def after_create_account(user, auth)
|
||||||
data = auth[:extra_data]
|
data = auth[:extra_data]
|
||||||
Oauth2UserInfo.create(
|
association = Oauth2UserInfo.find_or_initialize_by(provider: data[:provider], uid: data[:uid])
|
||||||
uid: data[:uid],
|
association.user = user
|
||||||
provider: data[:provider],
|
association.email = auth[:email]
|
||||||
name: auth[:name],
|
association.save!
|
||||||
email: auth[:email],
|
|
||||||
user_id: user.id
|
|
||||||
)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def description_for_user(user)
|
def description_for_user(user)
|
||||||
|
Reference in New Issue
Block a user