1
0
Fork 0
mirror of https://github.com/heartcombo/devise.git synced 2022-11-09 12:18:31 -05:00

Timeoutable also skips tracking if skip_trackable is given

This commit is contained in:
José Valim 2011-10-25 18:43:34 +02:00
parent 6fcfba229d
commit d448e7d841
3 changed files with 15 additions and 1 deletions

View file

@ -1,5 +1,8 @@
== 1.5.0.dev
* enhancements
* Timeoutable also skips tracking if skip_trackable is given
* bug fix
* Allow idempotent API requests
* Fix bug where logs did not show 401 as status code

View file

@ -17,6 +17,8 @@ Warden::Manager.after_set_user do |record, warden, options|
end
end
warden.session(scope)['last_request_at'] = Time.now.utc
unless warden.request.env['devise.skip_trackable']
warden.session(scope)['last_request_at'] = Time.now.utc
end
end
end

View file

@ -16,6 +16,15 @@ class SessionTimeoutTest < ActionController::IntegrationTest
assert_not_equal old_last_request, last_request_at
end
test 'set last request at in user session after each request is skipped if tracking is disabled' do
sign_in_as_user
old_last_request = last_request_at
assert_not_nil last_request_at
get users_path, {}, 'devise.skip_trackable' => true
assert_equal old_last_request, last_request_at
end
test 'not time out user session before default limit time' do
sign_in_as_user
assert_response :success