Commit 92d98f5a0c28bffd7b070cda190b07ab72667d58

Authored by Dmitriy Zaporozhets
2 parents 60d3e948 a2d244ec

Merge pull request #1118 from patthoyts/pt/ldap-missing-password

Handle LDAP missing credentials error with a flash message.
@@ -13,7 +13,7 @@ gem "devise", "~> 2.1.0" @@ -13,7 +13,7 @@ gem "devise", "~> 2.1.0"
13 gem "grit", :git => "https://github.com/gitlabhq/grit.git", :ref => "7f35cb98ff17d534a07e3ce6ec3d580f67402837" 13 gem "grit", :git => "https://github.com/gitlabhq/grit.git", :ref => "7f35cb98ff17d534a07e3ce6ec3d580f67402837"
14 gem "gitolite", :git => "https://github.com/gitlabhq/gitolite-client.git", :ref => "9b715ca8bab6529f6c92204a25f84d12f25a6eb0" 14 gem "gitolite", :git => "https://github.com/gitlabhq/gitolite-client.git", :ref => "9b715ca8bab6529f6c92204a25f84d12f25a6eb0"
15 gem "pygments.rb", :git => "https://github.com/gitlabhq/pygments.rb.git", :ref => "2cada028da5054616634a1d9ca6941b65b3ce188" 15 gem "pygments.rb", :git => "https://github.com/gitlabhq/pygments.rb.git", :ref => "2cada028da5054616634a1d9ca6941b65b3ce188"
16 -gem "omniauth-ldap", :git => "https://github.com/gitlabhq/omniauth-ldap.git", :ref => "7edf27d0281e09561838122982c16b7e62181f44" 16 +gem "omniauth-ldap", :git => "https://github.com/gitlabhq/omniauth-ldap.git", :ref => "f038dd852d7bd473a557e385d5d7c2fd5dc1dc2e"
17 gem 'yaml_db', :git => "https://github.com/gitlabhq/yaml_db.git" 17 gem 'yaml_db', :git => "https://github.com/gitlabhq/yaml_db.git"
18 gem 'grack', :git => "https://github.com/gitlabhq/grack.git" 18 gem 'grack', :git => "https://github.com/gitlabhq/grack.git"
19 gem "linguist", "~> 1.0.0", :git => "https://github.com/gitlabhq/linguist.git" 19 gem "linguist", "~> 1.0.0", :git => "https://github.com/gitlabhq/linguist.git"
@@ -42,8 +42,8 @@ GIT @@ -42,8 +42,8 @@ GIT
42 42
43 GIT 43 GIT
44 remote: https://github.com/gitlabhq/omniauth-ldap.git 44 remote: https://github.com/gitlabhq/omniauth-ldap.git
45 - revision: 7edf27d0281e09561838122982c16b7e62181f44  
46 - ref: 7edf27d0281e09561838122982c16b7e62181f44 45 + revision: f038dd852d7bd473a557e385d5d7c2fd5dc1dc2e
  46 + ref: f038dd852d7bd473a557e385d5d7c2fd5dc1dc2e
47 specs: 47 specs:
48 omniauth-ldap (1.0.2) 48 omniauth-ldap (1.0.2)
49 net-ldap (~> 0.2.2) 49 net-ldap (~> 0.2.2)
app/controllers/omniauth_callbacks_controller.rb
@@ -3,13 +3,10 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController @@ -3,13 +3,10 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController
3 # Extend the standard message generation to accept our custom exception 3 # Extend the standard message generation to accept our custom exception
4 def failure_message 4 def failure_message
5 exception = env["omniauth.error"] 5 exception = env["omniauth.error"]
6 - if exception.class == OmniAuth::Error  
7 - error = exception.message  
8 - else  
9 - error = exception.error_reason if exception.respond_to?(:error_reason)  
10 - error ||= exception.error if exception.respond_to?(:error)  
11 - error ||= env["omniauth.error.type"].to_s  
12 - end 6 + error = exception.error_reason if exception.respond_to?(:error_reason)
  7 + error ||= exception.error if exception.respond_to?(:error)
  8 + error ||= exception.message if exception.respond_to?(:message)
  9 + error ||= env["omniauth.error.type"].to_s
13 error.to_s.humanize if error 10 error.to_s.humanize if error
14 end 11 end
15 12