Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
da07665b
Commit
da07665b
authored
Jul 18, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4289 from karlhungus/feature-ldap-signin-with-email-or-username
Allow the ldap logins with email or username
parents
2c191ab0
d04f3286
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
1 deletion
+11
-1
config/gitlab.yml.example
config/gitlab.yml.example
+1
-0
config/initializers/1_settings.rb
config/initializers/1_settings.rb
+2
-0
config/initializers/devise.rb
config/initializers/devise.rb
+8
-1
No files found.
config/gitlab.yml.example
View file @
da07665b
...
...
@@ -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:
...
...
config/initializers/1_settings.rb
View file @
da07665b
...
...
@@ -37,6 +37,8 @@ end
# Default settings
Settings
[
'ldap'
]
||=
Settingslogic
.
new
({})
Settings
.
ldap
[
'enabled'
]
=
false
if
Settings
.
ldap
[
'enabled'
].
nil?
Settings
.
ldap
[
'allow_username_or_email_login'
]
=
false
if
Settings
.
ldap
[
'allow_username_or_email_login'
].
nil?
Settings
[
'omniauth'
]
||=
Settingslogic
.
new
({})
Settings
.
omniauth
[
'enabled'
]
=
false
if
Settings
.
omniauth
[
'enabled'
].
nil?
...
...
config/initializers/devise.rb
View file @
da07665b
...
...
@@ -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
=
->
(
name
)
{
name
.
gsub
(
/@.*$/
,
''
)}
else
email_stripping_proc
=
->
(
name
)
{
name
}
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
|
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment