diff options
author | Douwe Maan <douwe@gitlab.com> | 2015-09-08 12:58:48 +0300 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2015-09-08 18:18:14 +0300 |
commit | c915e2c8237ddcae57ec48e700badd9d5bfd8c8c (patch) | |
tree | 045b66c46a9af2022734ccf390ccd979f2ddb07a /lib/gitlab/o_auth/auth_hash.rb | |
parent | e0da2c352325c1cb2ede88a73434ed7afc037481 (diff) |
Allow configuration of LDAP attributes GitLab will use for the new user account.
Diffstat (limited to 'lib/gitlab/o_auth/auth_hash.rb')
-rw-r--r-- | lib/gitlab/o_auth/auth_hash.rb | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/lib/gitlab/o_auth/auth_hash.rb b/lib/gitlab/o_auth/auth_hash.rb index 9b8e783d16c..76fbe698c74 100644 --- a/lib/gitlab/o_auth/auth_hash.rb +++ b/lib/gitlab/o_auth/auth_hash.rb @@ -16,16 +16,6 @@ module Gitlab @provider ||= Gitlab::Utils.force_utf8(auth_hash.provider.to_s) end - def info - auth_hash.info - end - - def get_info(key) - value = info.try(key) - Gitlab::Utils.force_utf8(value) if value - value - end - def name @name ||= get_info(:name) || "#{get_info(:first_name)} #{get_info(:last_name)}" end @@ -44,9 +34,21 @@ module Gitlab private + def info + auth_hash.info + end + + def get_info(key) + key = :nickname if key == :username + + value = info[key] + Gitlab::Utils.force_utf8(value) if value + value + end + def username_and_email @username_and_email ||= begin - username = get_info(:nickname) || get_info(:username) + username = get_info(:username) email = get_info(:email) username ||= generate_username(email) if email |