Last active
December 19, 2015 05:49
-
-
Save ak47/5906514 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Devise | |
module Strategies | |
class MyAuthenticatable < Authenticatable | |
def authenticate! | |
begin | |
if resp = authenticate_local | |
else | |
fail!('Invalid username or password') | |
end | |
rescue Error => e | |
redirect! weak_password_path | |
end | |
end | |
end | |
end | |
end | |
Warden::Strategies.add(:pf_authenticatable, Devise::Strategies::PfAuthenticatable) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
authenticate_local raises an exception, re-raising in rescue does not bubble up to Rails.
redirect! does not work