Improvement: downcase the email when searching for an account by email

Improvement of 2b9869e (FEATURE: If the email is verified, we can use that to find accounts): Downcasing the email which has been got from the OAuth provider, as the email entity is not case-sensitive in Discourse.
This commit is contained in:
Mikhail Vink 2015-11-15 21:23:09 +01:00
parent 2b9869ef2e
commit b557addab2
1 changed files with 1 additions and 1 deletions

View File

@ -75,7 +75,7 @@ class OAuth2BasicAuthenticator < ::Auth::OAuth2Authenticator
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
result.user = User.where(email: Email.downcase(result.email)).first
end
result.extra_data = { oauth2_basic_user_id: user_details[:user_id] }