Class: Devise::Api::ResourceOwnerService::Authenticate

Inherits:
BaseService
  • Object
show all
Defined in:
app/services/devise/api/resource_owner_service/authenticate.rb

Instance Method Summary collapse

Instance Method Details

#callObject



10
11
12
13
14
15
16
# File 'app/services/devise/api/resource_owner_service/authenticate.rb', line 10

def call
  resource = resource_class.find_for_authentication(email: params[:email])
  return Failure(error: :invalid_email, record: nil) if resource.blank?
  return Failure(error: :invalid_authentication, record: resource) unless authenticate!(resource)

  Success(resource)
end