FIX: Downcase email coming back from auth-provider

This commit is contained in:
Blake Erickson 2019-08-13 10:53:38 -06:00
parent c628166bb4
commit 296cdc53ee
2 changed files with 9 additions and 0 deletions

View File

@ -18,6 +18,10 @@ class Auth::Result
@failed = false
end
def email
@email.downcase
end
def failed?
!!@failed
end

View File

@ -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 }))