Fix gravatar and ldap config

This commit is contained in:
Riyad Preukschas 2012-12-15 02:19:21 +01:00
parent 19eb637419
commit 757c7a5291
4 changed files with 14 additions and 16 deletions

View file

@ -34,7 +34,7 @@ module ApplicationHelper
def gravatar_icon(user_email = '', size = nil)
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'
else
gravatar_url = request.ssl? ? Gitlab.config.gravatar.ssl_url : Gitlab.config.gravatar.plain_url

View file

@ -33,7 +33,7 @@
%ul
%li
%p You can change your password on Account page
-unless Gitlab.config.disable_gravatar?
- if Gitlab.config.gravatar.enabled
%li
%p You can change your avatar at #{link_to "gravatar.com", "http://gravatar.com"}

View file

@ -205,20 +205,18 @@ Devise.setup do |config|
# manager.default_strategies(:scope => :user).unshift :some_external_strategy
# end
gl = Gitlab.config
if gl.ldap_enabled?
if Gitlab.config.ldap.enabled
config.omniauth :ldap,
:host => gl.ldap['host'],
:base => gl.ldap['base'],
:uid => gl.ldap['uid'],
:port => gl.ldap['port'],
:method => gl.ldap['method'],
:bind_dn => gl.ldap['bind_dn'],
:password => gl.ldap['password']
:host => Gitlab.config.ldap['host'],
:base => Gitlab.config.ldap['base'],
:uid => Gitlab.config.ldap['uid'],
:port => Gitlab.config.ldap['port'],
:method => Gitlab.config.ldap['method'],
:bind_dn => Gitlab.config.ldap['bind_dn'],
:password => Gitlab.config.ldap['password']
end
gl.omniauth_providers.each do |gl_provider|
config.omniauth gl_provider['name'].to_sym, gl_provider['app_id'], gl_provider['app_secret']
Gitlab.config.omniauth.providers.each do |provider|
config.omniauth provider['name'].to_sym, provider['app_id'], provider['app_secret']
end
end

View file

@ -43,7 +43,7 @@ describe ApplicationHelper do
let(:user_email) { 'user@email.com' }
it "should return a generic avatar path when Gravatar is disabled" do
Gitlab.config.stub(:disable_gravatar?).and_return(true)
Gitlab.config.gravatar.stub(:enabled).and_return(false)
gravatar_icon(user_email).should == 'no_avatar.png'
end
@ -63,7 +63,7 @@ describe ApplicationHelper do
it "should return custom gravatar path when gravatar_url is set" do
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'
end