Sha256: 57b40506d0e42304bdf852ab90d9deb01274d103fcd27cf815d60a5d495eebfd

Contents?: true

Size: 813 Bytes

Versions: 13

Compression:

Stored size: 813 Bytes

Contents

require 'devise/strategies/authenticatable'

module Devise
  module Strategies
    # Default strategy for signing in a user, based on their email and password in the database.
    class DatabaseAuthenticatable < Authenticatable
      def authenticate!
        resource  = valid_password? && mapping.to.find_for_database_authentication(authentication_hash)
        encrypted = false

        if validate(resource){ encrypted = true; resource.valid_password?(password) }
          resource.after_database_authentication
          success!(resource)
        end

        mapping.to.new.password = password if !encrypted && Devise.paranoid
        fail(:not_found_in_database) unless resource
      end
    end
  end
end

Warden::Strategies.add(:database_authenticatable, Devise::Strategies::DatabaseAuthenticatable)

Version data entries

13 entries across 13 versions & 4 rubygems

Version Path
brainsome_devise-3.3.0 lib/devise/strategies/database_authenticatable.rb
devise-3.3.0 lib/devise/strategies/database_authenticatable.rb
devbootsrap-0.0.7 lib/devise/strategies/database_authenticatable.rb
devbootsrap-0.0.6 lib/devise/strategies/database_authenticatable.rb
devbootsrap-0.0.5 lib/devise/strategies/database_authenticatable.rb
devbootsrap-0.0.4 lib/devise/strategies/database_authenticatable.rb
devbootsrap-0.0.3 lib/devise/strategies/database_authenticatable.rb
devbootsrap-0.0.2 lib/devise/strategies/database_authenticatable.rb
devbootsrap-0.0.1 lib/devise/strategies/database_authenticatable.rb
devise-bootstrap-0.0.2 lib/devise/strategies/database_authenticatable.rb
devise-bootstrap-0.0.1 lib/devise/devise/strategies/database_authenticatable.rb
devise-3.2.4 lib/devise/strategies/database_authenticatable.rb
devise-3.2.3 lib/devise/strategies/database_authenticatable.rb