Sha256: 5a51687d727aaf27b9e1f5ba4497b0799a766dfb7feb00049d2feb2da335bc1e

Contents?: true

Size: 580 Bytes

Versions: 2

Compression:

Stored size: 580 Bytes

Contents

require 'mongoid'

module OmniAuth
  module Identity
    module Models
      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

2 entries across 2 versions & 1 rubygems

Version Path
omniauth-identity-3.0.1 lib/omniauth/identity/models/mongoid.rb
omniauth-identity-3.0.0 lib/omniauth/identity/models/mongoid.rb