diff options
author | Patricio Cano <suprnova32@gmail.com> | 2015-12-22 13:00:41 -0500 |
---|---|---|
committer | Patricio Cano <suprnova32@gmail.com> | 2015-12-22 13:23:35 -0500 |
commit | 1d3889eb465655af5f7e3e6c3af9f3f529e6c9b5 (patch) | |
tree | 2dc76089722d3f5d1bb34de44bb246ba96faf764 /lib | |
parent | 1cf45407d3be9e9767d27e55b6f3e2e0d8dea36f (diff) | |
download | gitlab-ce-1d3889eb465655af5f7e3e6c3af9f3f529e6c9b5.tar.gz |
Fix identity and user retrieval when special characters are used
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/ldap/user.rb | 4 | ||||
-rw-r--r-- | lib/gitlab/o_auth/user.rb | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/lib/gitlab/ldap/user.rb b/lib/gitlab/ldap/user.rb index 4be99dd88c2..01bfe09cf07 100644 --- a/lib/gitlab/ldap/user.rb +++ b/lib/gitlab/ldap/user.rb @@ -14,7 +14,7 @@ module Gitlab # LDAP distinguished name is case-insensitive identity = ::Identity. where(provider: provider). - where('lower(extern_uid) = ?', uid.mb_chars.downcase.to_s).last + iwhere(extern_uid: uid.mb_chars.to_s).last identity && identity.user end end @@ -31,7 +31,7 @@ module Gitlab def find_by_uid_and_provider self.class.find_by_uid_and_provider( - auth_hash.uid.downcase, auth_hash.provider) + auth_hash.uid, auth_hash.provider) end def find_by_email diff --git a/lib/gitlab/o_auth/user.rb b/lib/gitlab/o_auth/user.rb index 17ce4d4b174..f1a362f5303 100644 --- a/lib/gitlab/o_auth/user.rb +++ b/lib/gitlab/o_auth/user.rb @@ -64,7 +64,7 @@ module Gitlab # If a corresponding person exists with same uid in a LDAP server, # set up a Gitlab user with dual LDAP and Omniauth identities. - if user = Gitlab::LDAP::User.find_by_uid_and_provider(ldap_person.dn.downcase, ldap_person.provider) + if user = Gitlab::LDAP::User.find_by_uid_and_provider(ldap_person.dn, ldap_person.provider) # Case when a LDAP user already exists in Gitlab. Add the Omniauth identity to existing account. user.identities.build(extern_uid: auth_hash.uid, provider: auth_hash.provider) else |