Sha256: 96ad105c74bbd19995cbe31708c68725126ef8796a8d4feb3d6a49f2ca8d480f
Contents?: true
Size: 811 Bytes
Versions: 5
Compression:
Stored size: 811 Bytes
Contents
require 'devise/strategies/authenticatable' module Devise module Strategies # Default strategy for signing in a user, based on his 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
5 entries across 5 versions & 1 rubygems