diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-01-09 16:43:21 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-01-09 16:43:21 +0000 |
commit | cbd367b7fa232be37781bba1063c38d5ac36e94b (patch) | |
tree | d1b776eca6c20348175f190dec2682054434e212 /actionpack/lib | |
parent | 75fca04590a310bedc66a455d7508168ae932ba4 (diff) | |
download | rails-cbd367b7fa232be37781bba1063c38d5ac36e94b.tar.gz rails-cbd367b7fa232be37781bba1063c38d5ac36e94b.tar.bz2 rails-cbd367b7fa232be37781bba1063c38d5ac36e94b.zip |
Added :before option to authentication
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@352 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_controller/authentication.rb | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/actionpack/lib/action_controller/authentication.rb b/actionpack/lib/action_controller/authentication.rb index 3ba193c1b2..f4ccde20ca 100644 --- a/actionpack/lib/action_controller/authentication.rb +++ b/actionpack/lib/action_controller/authentication.rb @@ -34,9 +34,11 @@ module ActionController #:nodoc: # # Options are: # * <tt>:by</tt> - the code fragment that will be evaluated on each request to determine whether the request is authenticated. + # * <tt>:before</tt> - a code fragment that's run before the failure redirect happens, such as + # '@session[:return_to] = @request.request_uri'. # * <tt>:failure</tt> - redirection options following the format of Base#url_for. def authentication(options) - options.assert_valid_keys([:by, :failure]) + options.assert_valid_keys([:by, :failure, :before]) class_eval <<-EOV protected def actions_excepted_from_authentication @@ -71,6 +73,7 @@ module ActionController #:nodoc: if !action_needs_authentication? || #{options[:by]} return true else + #{options[:before]} redirect_to(#{options[:failure].inspect}) return false end |