From 502a0fe77856591365326ead06b4db02fb7ec3f8 Mon Sep 17 00:00:00 2001 From: Sam Date: Mon, 10 Dec 2018 09:27:00 +1100 Subject: [PATCH] FIX: support connecting GitHub with existing accounts --- lib/auth/github_authenticator.rb | 4 ++++ spec/components/auth/github_authenticator_spec.rb | 2 ++ 2 files changed, 6 insertions(+) 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)