diff --git a/lib/auth/result.rb b/lib/auth/result.rb index 8ad478c292..d825758433 100644 --- a/lib/auth/result.rb +++ b/lib/auth/result.rb @@ -18,6 +18,10 @@ class Auth::Result @failed = false end + def email + @email.downcase + end + def failed? !!@failed end diff --git a/spec/components/auth/managed_authenticator_spec.rb b/spec/components/auth/managed_authenticator_spec.rb index ba463ed44e..84889de712 100644 --- a/spec/components/auth/managed_authenticator_spec.rb +++ b/spec/components/auth/managed_authenticator_spec.rb @@ -90,6 +90,11 @@ describe Auth::ManagedAuthenticator do end describe 'match by email' do + it 'downcases the email address from the authprovider' do + result = authenticator.after_authenticate(hash.deep_merge(info: { email: "HELLO@example.com" })) + expect(result.email).to eq('hello@example.com') + end + it 'works normally' do user = Fabricate(:user) result = authenticator.after_authenticate(hash.deep_merge(info: { email: user.email }))