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

Handle LDAP missing credentials error with a flash message.
This commit is contained in:
Dmitriy Zaporozhets 2012-07-25 01:51:06 -07:00
commit 92d98f5a0c
3 changed files with 7 additions and 10 deletions

View file

@ -3,13 +3,10 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController
# Extend the standard message generation to accept our custom exception
def failure_message
exception = env["omniauth.error"]
if exception.class == OmniAuth::Error
error = exception.message
else
error = exception.error_reason if exception.respond_to?(:error_reason)
error ||= exception.error if exception.respond_to?(:error)
error ||= env["omniauth.error.type"].to_s
end
error = exception.error_reason if exception.respond_to?(:error_reason)
error ||= exception.error if exception.respond_to?(:error)
error ||= exception.message if exception.respond_to?(:message)
error ||= env["omniauth.error.type"].to_s
error.to_s.humanize if error
end