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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
e45861d7
Commit
e45861d7
authored
Sep 11, 2014
by
Jan-Willem van der Meer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Display multiple LDAP servers on login page
parent
8772c2a1
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
23 additions
and
14 deletions
+23
-14
app/controllers/omniauth_callbacks_controller.rb
app/controllers/omniauth_callbacks_controller.rb
+7
-0
app/controllers/sessions_controller.rb
app/controllers/sessions_controller.rb
+4
-0
app/helpers/application_helper.rb
app/helpers/application_helper.rb
+0
-4
app/helpers/oauth_helper.rb
app/helpers/oauth_helper.rb
+1
-1
app/views/devise/sessions/_new_ldap.html.haml
app/views/devise/sessions/_new_ldap.html.haml
+1
-1
app/views/devise/sessions/new.html.haml
app/views/devise/sessions/new.html.haml
+9
-7
config/initializers/7_omniauth.rb
config/initializers/7_omniauth.rb
+1
-1
No files found.
app/controllers/omniauth_callbacks_controller.rb
View file @
e45861d7
...
...
@@ -30,6 +30,13 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController
end
end
alias_method
:ldap0
,
:ldap
alias_method
:ldap1
,
:ldap
alias_method
:ldap2
,
:ldap
alias_method
:ldap3
,
:ldap
alias_method
:ldap4
,
:ldap
alias_method
:ldap5
,
:ldap
def
omniauth_error
@provider
=
params
[
:provider
]
@error
=
params
[
:error
]
...
...
app/controllers/sessions_controller.rb
View file @
e45861d7
...
...
@@ -18,6 +18,10 @@ class SessionsController < Devise::SessionsController
store_location_for
(
:redirect
,
redirect_path
)
end
if
Gitlab
.
config
.
ldap
.
enabled
@ldap_servers
=
Gitlab
.
config
.
ldap
.
servers
end
super
end
...
...
app/helpers/application_helper.rb
View file @
e45861d7
...
...
@@ -244,10 +244,6 @@ module ApplicationHelper
end
end
def
ldap_enabled?
Gitlab
.
config
.
ldap
.
enabled
end
def
link_to
(
name
=
nil
,
options
=
nil
,
html_options
=
nil
,
&
block
)
begin
uri
=
URI
(
options
)
...
...
app/helpers/oauth_helper.rb
View file @
e45861d7
module
OauthHelper
def
ldap_enabled?
Devise
.
omniauth_providers
.
include?
(
:ldap
)
Gitlab
.
config
.
ldap
.
enabled
end
def
default_providers
...
...
app/views/devise/sessions/_new_ldap.html.haml
View file @
e45861d7
=
form_tag
(
user_omniauth_callback_path
(
:ldap
),
id:
'new_ldap_user'
)
do
=
form_tag
(
user_omniauth_callback_path
(
provider
),
id:
'new_ldap_user'
)
do
=
text_field_tag
:username
,
nil
,
{
class:
"form-control top"
,
placeholder:
"LDAP Login"
,
autofocus:
"autofocus"
}
=
password_field_tag
:password
,
nil
,
{
class:
"form-control bottom"
,
placeholder:
"Password"
}
%br
/
...
...
app/views/devise/sessions/new.html.haml
View file @
e45861d7
...
...
@@ -4,20 +4,22 @@
.panel-body
-
if
ldap_enabled?
&&
gitlab_config
.
signin_enabled
%ul
.nav.nav-tabs
%li
.active
=
link_to
'LDAP'
,
'#tab-ldap'
,
'data-toggle'
=>
'tab'
-
@ldap_servers
.
each_with_index
do
|
server
,
i
|
%li
{
class:
(
:active
if
server
[
'primary'
])}
=
link_to
server
[
'name'
],
"#tab-ldap
#{
i
}
"
,
'data-toggle'
=>
'tab'
%li
=
link_to
'Standard'
,
'#tab-signin'
,
'data-toggle'
=>
'tab'
.tab-content
%div
#tab-ldap
.tab-pane.active
=
render
partial:
'devise/sessions/new_ldap'
-
@ldap_servers
.
each_with_index
do
|
server
,
i
|
%div
.tab-pane
{
id:
"tab-ldap#{i}"
,
class:
(
:active
if
server
[
'primary'
])}
=
render
'devise/sessions/new_ldap'
,
provider:
"ldap
#{
i
}
"
%div
#tab-signin
.tab-pane
=
render
partial:
'devise/sessions/new_base'
=
render
'devise/sessions/new_base'
-
elsif
ldap_enabled?
=
render
partial:
'devise/sessions/new_ldap'
=
render
'devise/sessions/new_ldap'
,
ldap_servers:
@ldap_servers
-
elsif
gitlab_config
.
signin_enabled
=
render
partial:
'devise/sessions/new_base'
=
render
'devise/sessions/new_base'
-
else
%div
No authentication methods configured.
...
...
config/initializers/7_omniauth.rb
View file @
e45861d7
...
...
@@ -5,4 +5,4 @@ module OmniAuth::Strategies
class
Ldap3
<
LDAP
;
end
class
Ldap4
<
LDAP
;
end
class
Ldap5
<
LDAP
;
end
end
\ No newline at end of file
end
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