lib/outpost/model/authentication.rb in outpost-cms-0.0.3 vs lib/outpost/model/authentication.rb in outpost-cms-0.0.4
- old
+ new
@@ -5,16 +5,20 @@
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
+ 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)
+ if user = self.send(
+ "find_by_#{Outpost.config.authentication_attribute}", login)
user.authenticate(unencrypted_password)
else
false
end
end