mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 09:42:02 +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:
parent
b93b6c4299
commit
e42f33b6ba
|
@ -45,13 +45,10 @@ class Auth::OAuth2Authenticator < Auth::Authenticator
|
|||
|
||||
def after_create_account(user, auth)
|
||||
data = auth[:extra_data]
|
||||
Oauth2UserInfo.create(
|
||||
uid: data[:uid],
|
||||
provider: data[:provider],
|
||||
name: auth[:name],
|
||||
email: auth[:email],
|
||||
user_id: user.id
|
||||
)
|
||||
association = Oauth2UserInfo.find_or_initialize_by(provider: data[:provider], uid: data[:uid])
|
||||
association.user = user
|
||||
association.email = auth[:email]
|
||||
association.save!
|
||||
end
|
||||
|
||||
def description_for_user(user)
|
||||
|
|
Loading…
Reference in New Issue
Block a user