Commit 566badbaee55b7df45c7d912f80c372b6118b6ee
1 parent
3b34084b
Exists in
spb-stable
and in
2 other branches
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.
Showing
1 changed file
with
3 additions
and
1 deletions
Show diff stats
lib/gitlab/oauth/user.rb
... | ... | @@ -34,9 +34,11 @@ module Gitlab |
34 | 34 | # In this case we generate temporary email and force user to fill it later |
35 | 35 | if user.email.blank? |
36 | 36 | user.generate_tmp_oauth_email |
37 | - else | |
37 | + elsif provider != "ldap" | |
38 | 38 | # Google oauth returns email but dont return nickname |
39 | 39 | # So we use part of email as username for new user |
40 | + # For LDAP, username is already set to the user's | |
41 | + # uid/userid/sAMAccountName. | |
40 | 42 | user.username = email.match(/^[^@]*/)[0] |
41 | 43 | end |
42 | 44 | ... | ... |