diff options
author | Julien Pivotto <roidelapluie@inuits.eu> | 2014-05-09 11:37:27 +0200 |
---|---|---|
committer | Julien Pivotto <roidelapluie@inuits.eu> | 2014-05-12 07:30:35 +0200 |
commit | 566badbaee55b7df45c7d912f80c372b6118b6ee (patch) | |
tree | cd1679489fe68f46969c60ff36847f410216f8db /lib | |
parent | 3b34084bdeadecdceb0a86e2820dd7c5985099f6 (diff) | |
download | gitlab-ce-566badbaee55b7df45c7d912f80c372b6118b6ee.tar.gz |
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')
-rw-r--r-- | lib/gitlab/oauth/user.rb | 4 |
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 |