Created
December 30, 2009 20:33
-
-
Save mhfs/266367 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| # Each time a failed authentication attempt happens we call the lockable handlers | |
| Warden::Manager.before_failure do |record, warden, options| | |
| if record && record.respond_to?(:active?) && !record.active? | |
| scope = options[:scope] | |
| # If winning strategy was set, this is being called after authenticate and | |
| # there is no need to force a redirect. | |
| if warden.winning_strategy | |
| warden.winning_strategy.fail!(record.inactive_message) | |
| else | |
| throw :warden, :scope => scope, :message => record.inactive_message | |
| end | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment