Sha256: 0fcc3b9f50c8bbffdab50f96f5af91892a5cc02df6e24c3c113ff33b52ca08c8

Contents?: true

Size: 470 Bytes

Versions: 11

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

11 entries across 11 versions & 1 rubygems

Version Path
nyauth-0.5.0 app/models/concerns/nyauth/authenticatable.rb
nyauth-0.4.0 app/models/concerns/nyauth/authenticatable.rb
nyauth-0.3.0 app/models/concerns/nyauth/authenticatable.rb
nyauth-0.2.8 app/models/concerns/nyauth/authenticatable.rb
nyauth-0.2.7 app/models/concerns/nyauth/authenticatable.rb
nyauth-0.2.6 app/models/concerns/nyauth/authenticatable.rb
nyauth-0.2.5 app/models/concerns/nyauth/authenticatable.rb
nyauth-0.2.4 app/models/concerns/nyauth/authenticatable.rb
nyauth-0.2.3 app/models/concerns/nyauth/authenticatable.rb
nyauth-0.2.2 app/models/concerns/nyauth/authenticatable.rb
nyauth-0.2.1 app/models/concerns/nyauth/authenticatable.rb