diff --git a/lib/gitlab/ldap/user.rb b/lib/gitlab/ldap/user.rb index c8f3a69376..06c1e37063 100644 --- a/lib/gitlab/ldap/user.rb +++ b/lib/gitlab/ldap/user.rb @@ -13,8 +13,8 @@ module Gitlab def find_or_create(auth) @auth = auth - if uid.blank? || email.blank? - raise_error("Account must provide an uid and email address") + if uid.blank? || email.blank? || username.blank? + raise_error("Account must provide a dn, uid and email address") end user = find(auth) @@ -64,6 +64,10 @@ module Gitlab model.where(provider: provider, extern_uid: uid).last end + def username + auth.info.nickname.to_s.force_encoding("utf-8") + end + def provider 'ldap' end