FIX: support connecting GitHub with existing accounts

FIX: support connecting GitHub with existing accounts
From 502a0fe77856591365326ead06b4db02fb7ec3f8 Mon Sep 17 00:00:00 2001
From: Sam <sam.saffron@gmail.com>
Date: Mon, 10 Dec 2018 09:27:00 +1100
Subject: [PATCH] FIX: support connecting GitHub with existing accounts


diff --git a/lib/auth/github_authenticator.rb b/lib/auth/github_authenticator.rb
index d121421..4e352ef 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 797221c..58002fb 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)

GitHub