diff --git a/lib/gitlab/oauth/user.rb b/lib/gitlab/oauth/user.rb index 7f1d1cd..d154bd8 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 -- libgit2 0.21.2