Merge pull request #422 from steveprentice/master
This makes gitlabhq compatible with more LDAP servers (specifically OpenLDAP).
This commit is contained in:
commit
a44b85be9e
2 changed files with 6 additions and 6 deletions
|
@ -71,15 +71,15 @@ class User < ActiveRecord::Base
|
|||
name.split(" ").first unless name.blank?
|
||||
end
|
||||
|
||||
def self.find_for_ldap_auth(omniauth)
|
||||
username = omniauth.sAMAccountName[0]
|
||||
email = omniauth.userprincipalname[0]
|
||||
def self.find_for_ldap_auth(omniauth_info)
|
||||
name = omniauth_info.name
|
||||
email = omniauth_info.email
|
||||
|
||||
if @user = User.find_by_email(email)
|
||||
@user
|
||||
else
|
||||
password = generate_random_password
|
||||
@user = User.create(:name => username,
|
||||
@user = User.create(:name => name,
|
||||
:email => email,
|
||||
:password => password,
|
||||
:password_confirmation => password
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue