Commit 757c7a52 authored by Riyad Preukschas's avatar Riyad Preukschas

Fix gravatar and ldap config

parent 19eb6374
...@@ -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
......
...@@ -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"}
......
...@@ -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
...@@ -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(true) Gitlab.config.gravatar.stub(:enabled).and_return(false)
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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment