lib/devise.rb in devise-0.5.2 vs lib/devise.rb in devise-0.5.3
- old
+ new
@@ -10,27 +10,24 @@
STRATEGIES = [:authenticatable].freeze
SERIALIZERS = [:authenticatable, :rememberable].freeze
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
- }
+ # Maps the messages types that are used in flash message. This array is not
+ # frozen, so you can add messages from your own strategies.
+ FLASH_MESSAGES = [ :unauthenticated, :unconfirmed, :invalid ]
# Declare encryptors length which are used in migrations.
ENCRYPTORS_LENGTH = {
:sha1 => 40,
:sha512 => 128,
:clearance_sha1 => 40,
:restful_authentication_sha1 => 40,
:authlogic_sha512 => 128
}
- # Used to encrypt password. Please generate one with rake secret
+ # 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
@@ -65,22 +62,26 @@
# Stores the chosen ORM.
mattr_accessor :orm
@@orm = :active_record
+ # Configure default options used in :all.
+ mattr_accessor :all
+ @@all = Devise::ALL.dup
+
+ # Tells if devise should apply the schema in ORMs where devise declaration
+ # and schema belongs to the same class (as Datamapper and MongoMapper).
+ mattr_accessor :apply_schema
+ @@apply_schema = true
+
class << self
# Default way to setup Devise. Run script/generate devise_install to create
# a fresh initializer with all configuration values.
def setup
yield self
end
- def mail_sender=(value) #:nodoc:
- ActiveSupport::Deprecation.warn "Devise.mail_sender= is deprecated, use Devise.mailer_sender instead"
- DeviseMailer.sender = value
- end
-
# Sets the sender in DeviseMailer.
def mailer_sender=(value)
DeviseMailer.sender = value
end
alias :sender= :mailer_sender=
@@ -119,9 +120,14 @@
end
# The class of the configured ORM
def orm_class
Devise::Orm.const_get(@@orm.to_s.camelize.to_sym)
+ end
+
+ # Generate a friendly string randomically to be used as token.
+ def friendly_token
+ ActiveSupport::SecureRandom.base64(15).tr('+/=', '-_ ').strip.delete("\n")
end
end
end
begin