Sha256: 1fb79b974b1a5c9523de4c5a742fbcface2ca2e4813b4a3f66357929db4c4f27

Contents?: true

Size: 658 Bytes

Versions: 4

Compression:

Stored size: 658 Bytes

Contents

# frozen_string_literal: true

require 'mongoid'

module OmniAuth
  module Identity
    module Models
      # NOTE: Mongoid is based on ActiveModel.
      module Mongoid
        def self.included(base)
          base.class_eval do
            include ::OmniAuth::Identity::Model
            include ::OmniAuth::Identity::SecurePassword

            has_secure_password

            def self.auth_key=(key)
              super
              validates_uniqueness_of key, case_sensitive: false
            end

            def self.locate(search_hash)
              where(search_hash).first
            end
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
omniauth-identity-3.0.8 lib/omniauth/identity/models/mongoid.rb
omniauth-identity-3.0.7 lib/omniauth/identity/models/mongoid.rb
omniauth-identity-3.0.6 lib/omniauth/identity/models/mongoid.rb
omniauth-identity-3.0.5 lib/omniauth/identity/models/mongoid.rb