mirror of
https://github.com/heartcombo/devise.git
synced 2022-11-09 12:18:31 -05:00
documentation tweaks for extend_remember_period
This commit is contained in:
parent
058d433f28
commit
2939a61a49
4 changed files with 22 additions and 15 deletions
|
@ -89,15 +89,15 @@ module Devise
|
|||
mattr_accessor :password_length
|
||||
@@password_length = 6..20
|
||||
|
||||
# Time interval where the remember me token is valid.
|
||||
# The time the user will be remembered without asking for credentials again.
|
||||
mattr_accessor :remember_for
|
||||
@@remember_for = 2.weeks
|
||||
|
||||
# If a valid remember token can be re-used between multiple browsers.
|
||||
# If true, a valid remember token can be re-used between multiple browsers.
|
||||
mattr_accessor :remember_across_browsers
|
||||
@@remember_across_browsers = true
|
||||
|
||||
# Extend remember period everytime the user sign up.
|
||||
# If true, extends the user's remember period when remembered via cookie.
|
||||
mattr_accessor :extend_remember_period
|
||||
@@extend_remember_period = false
|
||||
|
||||
|
|
|
@ -18,11 +18,15 @@ module Devise
|
|||
# blocked and will have to enter his credentials again.
|
||||
# This configuration is also used to calculate the expires
|
||||
# time for the cookie created to remember the user.
|
||||
# By default remember_for is 2.weeks.
|
||||
# 2.weeks by default.
|
||||
#
|
||||
# remember_across_browsers: if a valid remember token can be re-used
|
||||
# between multiple browsers.
|
||||
# By default remember_across_browsers is true.
|
||||
# remember_across_browsers: if true, a valid remember token can be
|
||||
# re-used between multiple browsers.
|
||||
# True by default.
|
||||
#
|
||||
# extend_remember_period: if true, extends the user's remember period
|
||||
# when remembered via cookie.
|
||||
# False by default.
|
||||
#
|
||||
# Examples:
|
||||
#
|
||||
|
@ -80,14 +84,14 @@ module Devise
|
|||
|
||||
protected
|
||||
|
||||
# We just don't generate a token if remember across browser is given,
|
||||
# a remember token exists or it was expired.
|
||||
# Generate a token unless remember_across_browsers is true and there is
|
||||
# an existing remember_token or the existing remember_token has expried.
|
||||
def generate_remember_token? #:nodoc:
|
||||
!(self.class.remember_across_browsers && remember_token) || remember_expired?
|
||||
end
|
||||
|
||||
# We always generate a timestamp if extend_remember_period is true. Besides that,
|
||||
# we generate only if one does not exist or the current one expired.
|
||||
# Generate a timestamp if extend_remember_period is true, if no remember_token
|
||||
# exists, or if an existing remember token has expired.
|
||||
def generate_remember_timestamp? #:nodoc:
|
||||
self.class.extend_remember_period || remember_created_at.nil? || remember_expired?
|
||||
end
|
||||
|
|
|
@ -61,11 +61,11 @@ Devise.setup do |config|
|
|||
# The time the user will be remembered without asking for credentials again.
|
||||
# config.remember_for = 2.weeks
|
||||
|
||||
# If a valid remember token can be re-used between multiple browsers.
|
||||
# If true, a valid remember token can be re-used between multiple browsers.
|
||||
# config.remember_across_browsers = true
|
||||
|
||||
# When true, extends remember period when user signs up via cookie.
|
||||
# config.extend_remember_period = true
|
||||
# If true, extends the user's remember period when remembered via cookie.
|
||||
# config.extend_remember_period = false
|
||||
|
||||
# ==> Configuration for :validatable
|
||||
# Range for password length
|
||||
|
|
|
@ -58,9 +58,12 @@ Devise.setup do |config|
|
|||
# The time the user will be remembered without asking for credentials again.
|
||||
# config.remember_for = 2.weeks
|
||||
|
||||
# If a valid remember token can be re-used between multiple browsers.
|
||||
# If true, a valid remember token can be re-used between multiple browsers.
|
||||
# config.remember_across_browsers = true
|
||||
|
||||
# If true, extends the user's remember period when remembered via cookie.
|
||||
# config.extend_remember_period = false
|
||||
|
||||
# ==> Configuration for :validatable
|
||||
# Range for password length
|
||||
# config.password_length = 6..20
|
||||
|
|
Loading…
Reference in a new issue