mirror of
https://github.com/heartcombo/devise.git
synced 2022-11-09 12:18:31 -05:00
f41e4befde
There is a delegator to get failure app, introduced in4629bee
and tuned in24b26026
. The latter commit introduced a bit of logic, however, no tests are included into commit. Needless to say this resulted in a broken code. The point is that `env["warden.options"][:scope]` returns a string. However, `Devise.mappings` is a hash with symbol keys. Adding tests and converting scope to symbol here.
16 lines
392 B
Ruby
16 lines
392 B
Ruby
module Devise
|
|
# Checks the scope in the given environment and returns the associated failure app.
|
|
class Delegator
|
|
def call(env)
|
|
failure_app(env).call(env)
|
|
end
|
|
|
|
def failure_app(env)
|
|
app = env["warden.options"] &&
|
|
(scope = env["warden.options"][:scope]) &&
|
|
Devise.mappings[scope.to_sym].failure_app
|
|
|
|
app || Devise::FailureApp
|
|
end
|
|
end
|
|
end
|