From b557addab2826ca1d6a0f5988abc053bd5e05a4f Mon Sep 17 00:00:00 2001 From: Mikhail Vink Date: Sun, 15 Nov 2015 21:23:09 +0100 Subject: [PATCH] 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. --- plugin.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin.rb b/plugin.rb index 699fbf1..6039663 100644 --- a/plugin.rb +++ b/plugin.rb @@ -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] }