Commit 089605fe authored by Izaak Alpert's avatar Izaak Alpert

Allow the ldap logins with email or username

Change-Id: I73b4aa4c46afd56ae02fb24abcd673c0724547e4
parent 2c191ab0
......@@ -97,6 +97,7 @@ production: &base
method: 'ssl' # "ssl" or "plain"
bind_dn: '_the_full_dn_of_the_user_you_will_bind_with'
password: '_the_password_of_the_bind_user'
allow_username_or_email_login: true
## OmniAuth settings
omniauth:
......
......@@ -206,6 +206,12 @@ Devise.setup do |config|
# end
if Gitlab.config.ldap.enabled
if Gitlab.config.ldap.allow_username_or_email_login
email_stripping_proc = Proc.new {|name| name.gsub(/@.*$/,'')}
else
email_stripping_proc = lambda {|n|n}
end
config.omniauth :ldap,
host: Gitlab.config.ldap['host'],
base: Gitlab.config.ldap['base'],
......@@ -213,7 +219,8 @@ Devise.setup do |config|
port: Gitlab.config.ldap['port'],
method: Gitlab.config.ldap['method'],
bind_dn: Gitlab.config.ldap['bind_dn'],
password: Gitlab.config.ldap['password']
password: Gitlab.config.ldap['password'],
name_proc: email_stripping_proc
end
Gitlab.config.omniauth.providers.each do |provider|
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment