diff options
author | jessib <jessib@leap.se> | 2013-07-11 12:16:38 -0700 |
---|---|---|
committer | jessib <jessib@leap.se> | 2013-07-11 12:16:38 -0700 |
commit | 2daca14392db93617676a633a4562cfbbf4c0796 (patch) | |
tree | bf11d8d816df8fcfb77a64cbae1a407e72097ac0 /users/app | |
parent | 4991ac797b37a539d4d26837351c1f2c3505b58d (diff) |
Slight tweak in case we get back the default response to warden's fail!, which is not an enumerable.
Diffstat (limited to 'users/app')
-rw-r--r-- | users/app/controllers/controller_extension/authentication.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/users/app/controllers/controller_extension/authentication.rb b/users/app/controllers/controller_extension/authentication.rb index 6daffdb..5fac884 100644 --- a/users/app/controllers/controller_extension/authentication.rb +++ b/users/app/controllers/controller_extension/authentication.rb @@ -10,7 +10,6 @@ module ControllerExtension::Authentication def authentication_errors return unless attempted_login? errors = get_warden_errors - #default response to get_warden_errors is not an enumerable, so won't work if default is used errors.inject({}) do |translated,err| translated[err.first] = I18n.t(err.last) translated @@ -19,7 +18,9 @@ module ControllerExtension::Authentication def get_warden_errors if strategy = warden.winning_strategy - strategy.message + message = strategy.message + # in case we get back the default message to fail! + message.respond_to?(:inject) ? message : { base: message } else { login: :all_strategies_failed } end |