Commit 9c972754 authored by Douwe Maan's avatar Douwe Maan Committed by Bob Van Landuyt

User#ldap_email? is gone

parent ce24035d
...@@ -70,7 +70,7 @@ module Gitlab ...@@ -70,7 +70,7 @@ module Gitlab
found_user = Gitlab::LDAP::Person.find_by_dn(ldap_identity.extern_uid, adapter) found_user = Gitlab::LDAP::Person.find_by_dn(ldap_identity.extern_uid, adapter)
return found_user if found_user return found_user if found_user
if user.ldap_email? if user.external_email? && [nil, provider].include?(user.email_provider)
Gitlab::LDAP::Person.find_by_email(user.email, adapter) Gitlab::LDAP::Person.find_by_email(user.email, adapter)
end end
end end
......
...@@ -15,7 +15,7 @@ describe Gitlab::LDAP::Access, lib: true do ...@@ -15,7 +15,7 @@ describe Gitlab::LDAP::Access, lib: true do
it 'finds a user by email if the email came from LDAP' do it 'finds a user by email if the email came from LDAP' do
expect(Gitlab::LDAP::Person).to receive(:find_by_dn).and_return(nil) expect(Gitlab::LDAP::Person).to receive(:find_by_dn).and_return(nil)
expect(user).to receive(:ldap_email?).and_return(true) expect(user).to receive(:external_email?).and_return(true)
expect(Gitlab::LDAP::Person).to receive(:find_by_email) expect(Gitlab::LDAP::Person).to receive(:find_by_email)
access.find_ldap_user access.find_ldap_user
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment