1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Instance methods shouldnt be added until you actually call has_secure_password

This commit is contained in:
David Heinemeier Hansson 2010-12-29 10:18:14 -08:00
parent fd1cf13f74
commit 43433b3fb4

View file

@ -37,9 +37,12 @@ module ActiveModel
validates_confirmation_of :password
validates_presence_of :password_digest
include InstanceMethodsOnActivation
end
end
module InstanceMethodsOnActivation
# Returns self if the password is correct, otherwise false.
def authenticate(unencrypted_password)
if BCrypt::Password.new(password_digest) == unencrypted_password
@ -56,3 +59,4 @@ module ActiveModel
end
end
end
end