Sha256: 7af933f39490281e897d32a4194119eeb52eca7f0fccae747fff0f898a814ae5
Contents?: true
Size: 679 Bytes
Versions: 2
Compression:
Stored size: 679 Bytes
Contents
module Nyauth module Authenticatable extend ActiveSupport::Concern include Nyauth::PasswordDigestAbility include Nyauth::ResetPasswordAbility included do validates :email, presence: true scope :with_given_email, -> (given_email) { where(email: given_email) } end module ClassMethods def authenticate(given_email, given_password) record = candidate_for_authentication(given_email) return nil unless record record.verify_password?(given_password) ? record : nil end def candidate_for_authentication(given_email) with_given_email(given_email).last end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
nyauth-0.7.2 | app/models/concerns/nyauth/authenticatable.rb |
nyauth-0.7.1 | app/models/concerns/nyauth/authenticatable.rb |