ruby on rails - Declaring custom failure action for warden not working -
Currently in my warden manager has been declared a custom failure app.
Rails.configuration .middleware.use Warden :: Doing | Manager. Manager.default_strategies: Password Manager. Failure_app = Lambda {| Env | However, for one of my strategies I want to use a different failure action, so I tried to declare custom action in failure. Such as: Certify Duff! Email = consultant ["email"] || Consult ['session'] ['email'] pw = counseling ["password"] || Params ['session'] ['password'] user = user.find_b_mail email if user & amp; Amp; User.authenticate_and_activated (PW) Success! Throw User (: Warden, Accessories = & gt; "Foo" ,: Action = & gt ;: Failure) End End And even in my Controller action :
def sign_in @user = warden.authenticate! : Action = & gt; : Failure ... and And here is my failed action:
Deaf failure warden.custom_failure! Render: Jason = & gt; {: Success = & gt; Incorrect: errors = & gt; ["Login failed"]} But the point is that it seems to be being ignored and only my manager knows what I'm doing wrong ?
I was able to understand my solution
my lambda With his suggestion to change, I was able to change my Warden Manager configuration:
Rails.configuration.middleware.use Warden :: Managing | Manager. Manager.default_strategies: Password Manager. Failure_app = Lambda {| Env | Fail_action = env ["warden.options"] [: verb] .to_sym sessions controller. Activity (fail_action) .col (env)} end this. It seems that this "warden.options" is employed in the hash.
Comments
Post a Comment