Skip to content

Commit

Permalink
FEATURE: If the email is verified, we can use that to find accounts
Browse files Browse the repository at this point in the history
  • Loading branch information
eviltrout committed Nov 13, 2015
1 parent fcc4b41 commit 2b9869e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion plugin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,15 @@ def after_authenticate(auth)
result.name = user_details[:name]
result.username = user_details[:username]
result.email = user_details[:email]
result.email_valid = result.email.present? && SiteSetting.oauth2_email_verified
result.email_valid = result.email.present? && SiteSetting.oauth2_email_verified?

current_info = ::PluginStore.get("oauth2_basic", "oauth2_basic_user_#{user_details[:user_id]}")
if current_info
result.user = User.where(id: current_info[:user_id]).first
elsif SiteSetting.oauth2_email_verified?
result.user = User.where(email: result.email).first
end

result.extra_data = { oauth2_basic_user_id: user_details[:user_id] }
result
end
Expand Down

0 comments on commit 2b9869e

Please sign in to comment.