From 566badbaee55b7df45c7d912f80c372b6118b6ee Mon Sep 17 00:00:00 2001 From: Julien Pivotto Date: Fri, 9 May 2014 11:37:27 +0200 Subject: 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. --- lib/gitlab/oauth/user.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 -- cgit v1.2.1