Sha256: f1a22d68419b8ca95a92d49f1834715348b937b213253670ee54cf602a3f29ab
Contents?: true
Size: 878 Bytes
Versions: 1
Compression:
Stored size: 878 Bytes
Contents
module Outpost module Model module Authentication extend ActiveSupport::Concern included do has_secure_password before_validation :downcase_email, if: -> { self.email_changed? } validates :name, presence: true validates Outpost.config.authentication_attribute, presence: true, uniqueness: true end module ClassMethods def authenticate(login, unencrypted_password) if user = self.send("find_by_#{Outpost.config.authentication_attribute}", login) user.authenticate(unencrypted_password) else false end end end # Private: Downcase the user's e-mail # # Returns String of the e-mail def downcase_email if self.email.present? self.email = self.email.downcase end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
outpost-cms-0.0.3 | lib/outpost/model/authentication.rb |