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
757c7a52
Commit
757c7a52
authored
Dec 15, 2012
by
Riyad Preukschas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix gravatar and ldap config
parent
19eb6374
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
16 deletions
+14
-16
app/helpers/application_helper.rb
app/helpers/application_helper.rb
+1
-1
app/views/profiles/show.html.haml
app/views/profiles/show.html.haml
+1
-1
config/initializers/devise.rb
config/initializers/devise.rb
+10
-12
spec/helpers/application_helper_spec.rb
spec/helpers/application_helper_spec.rb
+2
-2
No files found.
app/helpers/application_helper.rb
View file @
757c7a52
...
@@ -34,7 +34,7 @@ module ApplicationHelper
...
@@ -34,7 +34,7 @@ module ApplicationHelper
def
gravatar_icon
(
user_email
=
''
,
size
=
nil
)
def
gravatar_icon
(
user_email
=
''
,
size
=
nil
)
size
=
40
if
size
.
nil?
||
size
<=
0
size
=
40
if
size
.
nil?
||
size
<=
0
if
Gitlab
.
config
.
disable_gravatar?
||
user_email
.
blank?
if
!
Gitlab
.
config
.
gravatar
.
enabled
||
user_email
.
blank?
'no_avatar.png'
'no_avatar.png'
else
else
gravatar_url
=
request
.
ssl?
?
Gitlab
.
config
.
gravatar
.
ssl_url
:
Gitlab
.
config
.
gravatar
.
plain_url
gravatar_url
=
request
.
ssl?
?
Gitlab
.
config
.
gravatar
.
ssl_url
:
Gitlab
.
config
.
gravatar
.
plain_url
...
...
app/views/profiles/show.html.haml
View file @
757c7a52
...
@@ -33,7 +33,7 @@
...
@@ -33,7 +33,7 @@
%ul
%ul
%li
%li
%p
You can change your password on Account page
%p
You can change your password on Account page
-
unless
Gitlab
.
config
.
disable_gravatar?
-
if
Gitlab
.
config
.
gravatar
.
enabled
%li
%li
%p
You can change your avatar at
#{
link_to
"gravatar.com"
,
"http://gravatar.com"
}
%p
You can change your avatar at
#{
link_to
"gravatar.com"
,
"http://gravatar.com"
}
...
...
config/initializers/devise.rb
View file @
757c7a52
...
@@ -205,20 +205,18 @@ Devise.setup do |config|
...
@@ -205,20 +205,18 @@ Devise.setup do |config|
# manager.default_strategies(:scope => :user).unshift :some_external_strategy
# manager.default_strategies(:scope => :user).unshift :some_external_strategy
# end
# end
gl
=
Gitlab
.
config
if
Gitlab
.
config
.
ldap
.
enabled
if
gl
.
ldap_enabled?
config
.
omniauth
:ldap
,
config
.
omniauth
:ldap
,
:host
=>
gl
.
ldap
[
'host'
],
:host
=>
Gitlab
.
config
.
ldap
[
'host'
],
:base
=>
gl
.
ldap
[
'base'
],
:base
=>
Gitlab
.
config
.
ldap
[
'base'
],
:uid
=>
gl
.
ldap
[
'uid'
],
:uid
=>
Gitlab
.
config
.
ldap
[
'uid'
],
:port
=>
gl
.
ldap
[
'port'
],
:port
=>
Gitlab
.
config
.
ldap
[
'port'
],
:method
=>
gl
.
ldap
[
'method'
],
:method
=>
Gitlab
.
config
.
ldap
[
'method'
],
:bind_dn
=>
gl
.
ldap
[
'bind_dn'
],
:bind_dn
=>
Gitlab
.
config
.
ldap
[
'bind_dn'
],
:password
=>
gl
.
ldap
[
'password'
]
:password
=>
Gitlab
.
config
.
ldap
[
'password'
]
end
end
gl
.
omniauth_providers
.
each
do
|
gl_
provider
|
Gitlab
.
config
.
omniauth
.
providers
.
each
do
|
provider
|
config
.
omniauth
gl_provider
[
'name'
].
to_sym
,
gl_provider
[
'app_id'
],
gl_
provider
[
'app_secret'
]
config
.
omniauth
provider
[
'name'
].
to_sym
,
provider
[
'app_id'
],
provider
[
'app_secret'
]
end
end
end
end
spec/helpers/application_helper_spec.rb
View file @
757c7a52
...
@@ -43,7 +43,7 @@ describe ApplicationHelper do
...
@@ -43,7 +43,7 @@ describe ApplicationHelper do
let
(
:user_email
)
{
'user@email.com'
}
let
(
:user_email
)
{
'user@email.com'
}
it
"should return a generic avatar path when Gravatar is disabled"
do
it
"should return a generic avatar path when Gravatar is disabled"
do
Gitlab
.
config
.
stub
(
:disable_gravatar?
).
and_return
(
tru
e
)
Gitlab
.
config
.
gravatar
.
stub
(
:enabled
).
and_return
(
fals
e
)
gravatar_icon
(
user_email
).
should
==
'no_avatar.png'
gravatar_icon
(
user_email
).
should
==
'no_avatar.png'
end
end
...
@@ -63,7 +63,7 @@ describe ApplicationHelper do
...
@@ -63,7 +63,7 @@ describe ApplicationHelper do
it
"should return custom gravatar path when gravatar_url is set"
do
it
"should return custom gravatar path when gravatar_url is set"
do
stub!
(
:request
).
and_return
(
double
(
:ssl?
=>
false
))
stub!
(
:request
).
and_return
(
double
(
:ssl?
=>
false
))
Gitlab
.
config
.
stub
(
:gravatar
_url
).
and_return
(
'http://example.local/?s=%{size}&hash=%{hash}'
)
Gitlab
.
config
.
gravatar
.
stub
(
:plain
_url
).
and_return
(
'http://example.local/?s=%{size}&hash=%{hash}'
)
gravatar_icon
(
user_email
,
20
).
should
==
'http://example.local/?s=20&hash=b58c6f14d292556214bd64909bcdb118'
gravatar_icon
(
user_email
,
20
).
should
==
'http://example.local/?s=20&hash=b58c6f14d292556214bd64909bcdb118'
end
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