mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 20:01:14 +08:00
FIX: support connecting GitHub with existing accounts
This commit is contained in:
@ -41,6 +41,10 @@ class Auth::GithubAuthenticator < Auth::Authenticator
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def can_connect_existing_user?
|
||||||
|
true
|
||||||
|
end
|
||||||
|
|
||||||
def after_authenticate(auth_token, existing_account: nil)
|
def after_authenticate(auth_token, existing_account: nil)
|
||||||
result = Auth::Result.new
|
result = Auth::Result.new
|
||||||
|
|
||||||
|
@ -235,6 +235,8 @@ describe Auth::GithubAuthenticator do
|
|||||||
user1 = Fabricate(:user)
|
user1 = Fabricate(:user)
|
||||||
user2 = 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")
|
GithubUserInfo.create!(user_id: user1.id, github_user_id: 100, screen_name: "boris")
|
||||||
|
|
||||||
result = authenticator.after_authenticate(data, existing_account: user2)
|
result = authenticator.after_authenticate(data, existing_account: user2)
|
||||||
|
Reference in New Issue
Block a user