mirror of
https://github.com/heartcombo/devise.git
synced 2022-11-09 12:18:31 -05:00
Rename :timeout to :timeout_in and release gem again.
This commit is contained in:
parent
41ee6878a8
commit
c05b8cf2ce
6 changed files with 11 additions and 11 deletions
|
@ -36,7 +36,7 @@ Devise.setup do |config|
|
|||
|
||||
# The time you want to timeout the user session without activity. After this
|
||||
# time the user will be asked for credentials again.
|
||||
# config.timeout = 10.minutes
|
||||
# config.timeout_in = 10.minutes
|
||||
|
||||
# Configure the e-mail address which will be shown in DeviseMailer.
|
||||
# config.mailer_sender = "foo.bar@yourapp.com"
|
||||
|
|
|
@ -47,8 +47,8 @@ module Devise
|
|||
@@confirm_within = 0.days
|
||||
|
||||
# Time interval to timeout the user session without activity.
|
||||
mattr_accessor :timeout
|
||||
@@timeout = 30.minutes
|
||||
mattr_accessor :timeout_in
|
||||
@@timeout_in = 30.minutes
|
||||
|
||||
# Used to define the password encryption algorithm.
|
||||
mattr_accessor :encryptor
|
||||
|
|
|
@ -19,11 +19,11 @@ module Devise
|
|||
|
||||
# Checks whether the user session has expired based on configured time.
|
||||
def timeout?(last_access)
|
||||
last_access && last_access <= self.class.timeout.ago
|
||||
last_access && last_access <= self.class.timeout_in.ago
|
||||
end
|
||||
|
||||
module ClassMethods
|
||||
Devise::Models.config(self, :timeout)
|
||||
Devise::Models.config(self, :timeout_in)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -37,7 +37,7 @@ class SessionTimeoutTest < ActionController::IntegrationTest
|
|||
end
|
||||
|
||||
test 'user configured timeout limit' do
|
||||
swap Devise, :timeout => 8.minutes do
|
||||
swap Devise, :timeout_in => 8.minutes do
|
||||
user = sign_in_as_user
|
||||
|
||||
get users_path
|
||||
|
|
|
@ -15,12 +15,12 @@ class TimeoutableTest < ActiveSupport::TestCase
|
|||
end
|
||||
|
||||
test 'fallback to Devise config option' do
|
||||
swap Devise, :timeout => 1.minute do
|
||||
swap Devise, :timeout_in => 1.minute do
|
||||
user = new_user
|
||||
assert user.timeout?(2.minutes.ago)
|
||||
assert_not user.timeout?(30.seconds.ago)
|
||||
|
||||
Devise.timeout = 5.minutes
|
||||
Devise.timeout_in = 5.minutes
|
||||
assert_not user.timeout?(2.minutes.ago)
|
||||
assert user.timeout?(6.minutes.ago)
|
||||
end
|
||||
|
|
|
@ -41,7 +41,7 @@ class Configurable < User
|
|||
:pepper => 'abcdef',
|
||||
:confirm_within => 5.days,
|
||||
:remember_for => 7.days,
|
||||
:timeout => 15.minutes
|
||||
:timeout_in => 15.minutes
|
||||
end
|
||||
|
||||
class ActiveRecordTest < ActiveSupport::TestCase
|
||||
|
@ -113,8 +113,8 @@ class ActiveRecordTest < ActiveSupport::TestCase
|
|||
assert_equal 7.days, Configurable.remember_for
|
||||
end
|
||||
|
||||
test 'set a default value for timeout' do
|
||||
assert_equal 15.minutes, Configurable.timeout
|
||||
test 'set a default value for timeout_in' do
|
||||
assert_equal 15.minutes, Configurable.timeout_in
|
||||
end
|
||||
|
||||
test 'set null fields on migrations' do
|
||||
|
|
Loading…
Add table
Reference in a new issue