Commit 566badba authored by Julien Pivotto's avatar Julien Pivotto

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.
parent 3b34084b
......@@ -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
......
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