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
Jérome Perrin
gitlab-ce
Commits
dcf6c260
Commit
dcf6c260
authored
Oct 15, 2014
by
Jan-Willem van der Meer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Only enable LDAP providers if LDAP is enabled
parent
e3bd17a7
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
8 deletions
+10
-8
config/initializers/7_omniauth.rb
config/initializers/7_omniauth.rb
+9
-7
config/initializers/devise.rb
config/initializers/devise.rb
+1
-1
No files found.
config/initializers/7_omniauth.rb
View file @
dcf6c260
module
OmniAuth::Strategies
if
Gitlab
::
LDAP
::
Config
.
enabled?
module
OmniAuth::Strategies
server
=
Gitlab
.
config
.
ldap
.
servers
.
values
.
first
server
=
Gitlab
.
config
.
ldap
.
servers
.
values
.
first
const_set
(
server
[
'provider_class'
],
Class
.
new
(
LDAP
))
const_set
(
server
[
'provider_class'
],
Class
.
new
(
LDAP
))
end
end
OmniauthCallbacksController
.
class_eval
do
OmniauthCallbacksController
.
class_eval
do
server
=
Gitlab
.
config
.
ldap
.
servers
.
values
.
first
server
=
Gitlab
.
config
.
ldap
.
servers
.
values
.
first
alias_method
server
[
'provider_name'
],
:ldap
alias_method
server
[
'provider_name'
],
:ldap
end
end
end
\ No newline at end of file
config/initializers/devise.rb
View file @
dcf6c260
...
@@ -204,7 +204,7 @@ Devise.setup do |config|
...
@@ -204,7 +204,7 @@ Devise.setup do |config|
# manager.default_strategies(scope: :user).unshift :some_external_strategy
# manager.default_strategies(scope: :user).unshift :some_external_strategy
# end
# end
if
Gitlab
.
config
.
ldap
.
enabled
if
Gitlab
::
LDAP
::
Config
.
enabled?
Gitlab
.
config
.
ldap
.
servers
.
values
.
each
do
|
server
|
Gitlab
.
config
.
ldap
.
servers
.
values
.
each
do
|
server
|
if
server
[
'allow_username_or_email_login'
]
if
server
[
'allow_username_or_email_login'
]
email_stripping_proc
=
->
(
name
)
{
name
.
gsub
(
/@.*$/
,
''
)}
email_stripping_proc
=
->
(
name
)
{
name
.
gsub
(
/@.*$/
,
''
)}
...
...
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