Module: Sequel::Plugins::SecurePassword

Defined in:
lib/sequel/plugins/secure_password.rb

Defined Under Namespace

Modules: ClassMethods, InstanceMethods

Class Method Summary collapse

Class Method Details

.blank_string?(string) ⇒ Boolean

Returns:

  • (Boolean)


7
8
9
# File 'lib/sequel/plugins/secure_password.rb', line 7

def self.blank_string?(string)
  string.nil? or string =~ /\A\s*\z/
end

.configure(model, options = {}) ⇒ Object

Configure the plugin by setting the available options. Options:

  • :cost - the cost factor when creating password hash. Default:

BCrypt::Engine::DEFAULT_COST(10)

  • :include_validations - when set to false, password present and

confirmation validations won’t be included. Default: true



16
17
18
19
20
21
22
# File 'lib/sequel/plugins/secure_password.rb', line 16

def self.configure(model, options = {})
  model.instance_eval do
    @cost                = options.fetch(:cost, BCrypt::Engine.cost)
    @include_validations = options.fetch(:include_validations, true)
    @digest_column       = options.fetch(:digest_column, :password_digest)
  end
end