Skip to content

A platform for community discussion. Free, open, simple.

FIX: support connecting GitHub with existing accounts

Sam502a0fe77856
diff --git a/lib/auth/github_authenticator.rb b/lib/auth/github_authenticator.rb
index d12142114f2..4e352ef430a 100644
--- a/lib/auth/github_authenticator.rb
+++ b/lib/auth/github_authenticator.rb
@@ -41,6 +41,10 @@ class Auth::GithubAuthenticator < Auth::Authenticator
end
+ def can_connect_existing_user?
+ true
+ end
+
def after_authenticate(auth_token, existing_account: nil)
result = Auth::Result.new
diff --git a/spec/components/auth/github_authenticator_spec.rb b/spec/components/auth/github_authenticator_spec.rb
index 797221cfe22..58002fb9c83 100644
--- a/spec/components/auth/github_authenticator_spec.rb
+++ b/spec/components/auth/github_authenticator_spec.rb
@@ -235,6 +235,8 @@ describe Auth::GithubAuthenticator do
user1 = Fabricate(:user)
user2 = Fabricate(:user)
+ expect(authenticator.can_connect_existing_user?).to eq(true)
+
GithubUserInfo.create!(user_id: user1.id, github_user_id: 100, screen_name: "boris")
result = authenticator.after_authenticate(data, existing_account: user2)