Sha256: a326abca460f5f35f1cd298b23e66598d6bb84153d30879d6ccdbe5ff8cf3048
Contents?: true
Size: 860 Bytes
Versions: 9
Compression:
Stored size: 860 Bytes
Contents
require 'devise/strategies/base' module Devise module Strategies # Default strategy for signing in a user, based on his email and password. # Redirects to sign_in page if it's not authenticated class Authenticatable < Warden::Strategies::Base include Devise::Strategies::Base def valid? super && params[scope] && params[scope][:password].present? end # Authenticate a user based on email and password params, returning to warden # success and the authenticated user if everything is okay. Otherwise redirect # to sign in page. def authenticate! if resource = mapping.to.authenticate(params[scope]) success!(resource) else fail!(:invalid) end end end end end Warden::Strategies.add(:authenticatable, Devise::Strategies::Authenticatable)
Version data entries
9 entries across 9 versions & 1 rubygems