diff --git a/lib/devise.rb b/lib/devise.rb index 717619ce..e9cf7102 100644 --- a/lib/devise.rb +++ b/lib/devise.rb @@ -12,17 +12,31 @@ module Devise TRUE_VALUES = [true, 1, '1', 't', 'T', 'true', 'TRUE'].freeze # Maps the messages types that comes from warden to a flash type. + # This hash is not frozen, so you can add your messages as well. FLASH_MESSAGES = { :unauthenticated => :success, :unconfirmed => :failure } - # Models configuration - mattr_accessor :pepper, :stretches, :remember_for, :confirm_within + # Used to encrypt password. Please generate one with rake secret + mattr_accessor :pepper + @@pepper = nil + + # The number of times to encrypt password. + mattr_accessor :stretches + @@stretches = 10 + + # Time interval where the remember me token is valid. + mattr_accessor :remember_for + @@remember_for = 2.weeks + + # Time interval you can access your account before confirming your account. + mattr_accessor :confirm_within + @@confirm_within = 0.days - # Mappings + # Store scopes mappings. mattr_accessor :mappings - self.mappings = {} + @@mappings = {} class << self # Default way to setup Devise. Run script/generate devise_install to create @@ -76,4 +90,4 @@ module Devise end require 'devise/warden' -require 'devise/rails' +require 'devise/rails' \ No newline at end of file diff --git a/lib/devise/models.rb b/lib/devise/models.rb index 32f93044..21313734 100644 --- a/lib/devise/models.rb +++ b/lib/devise/models.rb @@ -16,9 +16,7 @@ module Devise # To add the class methods you need to have a module ClassMethods defined # inside the given class. # - def self.config(mod, accessor, default=nil) #:nodoc: - Devise.send :"#{accessor}=", default - + def self.config(mod, accessor) #:nodoc: mod.class_eval <<-METHOD, __FILE__, __LINE__ def #{accessor} self.class.#{accessor} diff --git a/lib/devise/models/authenticatable.rb b/lib/devise/models/authenticatable.rb index 1dcaa94f..f92dcdea 100644 --- a/lib/devise/models/authenticatable.rb +++ b/lib/devise/models/authenticatable.rb @@ -91,7 +91,7 @@ module Devise end Devise::Models.config(self, :pepper) - Devise::Models.config(self, :stretches, 10) + Devise::Models.config(self, :stretches) end end end diff --git a/lib/devise/models/confirmable.rb b/lib/devise/models/confirmable.rb index f4b56a61..a2e31c75 100644 --- a/lib/devise/models/confirmable.rb +++ b/lib/devise/models/confirmable.rb @@ -150,7 +150,7 @@ module Devise end end - Devise::Models.config(self, :confirm_within, 0.days) + Devise::Models.config(self, :confirm_within) end end end diff --git a/lib/devise/models/rememberable.rb b/lib/devise/models/rememberable.rb index 0bec5c8f..df04c553 100644 --- a/lib/devise/models/rememberable.rb +++ b/lib/devise/models/rememberable.rb @@ -89,7 +89,7 @@ module Devise end end - Devise::Models.config(self, :remember_for, 2.weeks) + Devise::Models.config(self, :remember_for) end end end