lib/padrino-admin/generators/templates/account/mongomapper.rb.tt in padrino-admin-0.11.2 vs lib/padrino-admin/generators/templates/account/mongomapper.rb.tt in padrino-admin-0.11.3
- old
+ new
@@ -25,10 +25,10 @@
##
# This method is for authentication purpose
#
def self.authenticate(email, password)
- account = first(:email => email) if email.present?
+ account = first(:email => /#{Regexp.escape(email)}/i) if email.present?
account && account.has_password?(password) ? account : nil
end
def has_password?(password)
::BCrypt::Password.new(crypted_password) == password