Sha256: d0b10bbde19d5db556d516d0adbfaf9acdd11be831aa92578737bbf914b00a8d

Contents?: true

Size: 470 Bytes

Versions: 4

Compression:

Stored size: 470 Bytes

Contents

module Nyauth
  module Authenticatable
    extend ActiveSupport::Concern
    include Nyauth::PasswordDigestAbility
    include Nyauth::ResetPasswordAbility

    included do
      validates :email, presence: true
    end

    module ClassMethods
      def authenticate(given_email, given_password)
        record = where(email: given_email).last
        return nil unless record

        record.verify_password?(given_password) ? record : nil
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
nyauth-0.7.0 app/models/concerns/nyauth/authenticatable.rb
nyauth-0.6.2 app/models/concerns/nyauth/authenticatable.rb
nyauth-0.6.1 app/models/concerns/nyauth/authenticatable.rb
nyauth-0.6.0 app/models/concerns/nyauth/authenticatable.rb