Allow plugins that implement OAuth and OAuth2 to show up under associated accounts in the Admin area. (#4333)

This commit is contained in:
cpradio 2016-07-18 03:02:41 -04:00 committed by Régis Hanol
parent d55da4fe1b
commit 64bdededd3
2 changed files with 7 additions and 5 deletions

View File

@ -782,6 +782,7 @@ class User < ActiveRecord::Base
result << "Facebook(#{facebook_user_info.username})" if facebook_user_info
result << "Google(#{google_user_info.email})" if google_user_info
result << "Github(#{github_user_info.screen_name})" if github_user_info
result << "#{oauth2_user_info.provider}(#{oauth2_user_info.email})" if oauth2_user_info
user_open_ids.each do |oid|
result << "OpenID #{oid.url[0..20]}...(#{oid.email})"

View File

@ -323,9 +323,10 @@ describe User do
FacebookUserInfo.create(user_id: user.id, username: "sam", facebook_user_id: 1)
GoogleUserInfo.create(user_id: user.id, email: "sam@sam.com", google_user_id: 1)
GithubUserInfo.create(user_id: user.id, screen_name: "sam", github_user_id: 1)
Oauth2UserInfo.create(user_id: user.id, provider: "linkedin", email: "sam@sam.com", uid: 1)
user.reload
expect(user.associated_accounts).to eq("Twitter(sam), Facebook(sam), Google(sam@sam.com), Github(sam)")
expect(user.associated_accounts).to eq("Twitter(sam), Facebook(sam), Google(sam@sam.com), Github(sam), linkedin(sam@sam.com)")
end
end