Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien Pivotto <roidelapluie@inuits.eu>2014-05-09 13:37:27 +0400
committerJulien Pivotto <roidelapluie@inuits.eu>2014-05-12 09:30:35 +0400
commit566badbaee55b7df45c7d912f80c372b6118b6ee (patch)
treecd1679489fe68f46969c60ff36847f410216f8db /lib/gitlab
parent3b34084bdeadecdceb0a86e2820dd7c5985099f6 (diff)
Use uid as username when creating user with LDAP
Without that commit, each user created by a LDAP login would have the first part of their email address as nickname. This is not useful for LDAP, where a uid attribute is already set.
Diffstat (limited to 'lib/gitlab')
-rw-r--r--lib/gitlab/oauth/user.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/gitlab/oauth/user.rb b/lib/gitlab/oauth/user.rb
index 7f1d1cd6532..d154bd8600b 100644
--- a/lib/gitlab/oauth/user.rb
+++ b/lib/gitlab/oauth/user.rb
@@ -34,9 +34,11 @@ module Gitlab
# In this case we generate temporary email and force user to fill it later
if user.email.blank?
user.generate_tmp_oauth_email
- else
+ elsif provider != "ldap"
# Google oauth returns email but dont return nickname
# So we use part of email as username for new user
+ # For LDAP, username is already set to the user's
+ # uid/userid/sAMAccountName.
user.username = email.match(/^[^@]*/)[0]
end