A platform for community discussion. Free, open, simple.
FIX: Allow OAuth2Authenticator to handle existing associations (#15259)
David Taylore42f33b6baa4
diff --git a/lib/auth/oauth2_authenticator.rb b/lib/auth/oauth2_authenticator.rbindex cff6d0c6e46..58365344f00 100644--- a/lib/auth/oauth2_authenticator.rb+++ b/lib/auth/oauth2_authenticator.rb@@ -45,13 +45,10 @@ class Auth::OAuth2Authenticator < Auth::Authenticatordef 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!enddef description_for_user(user)