def self.authenticate(email, password)
user = find_by_email(email)
if user && BCrypt::Password.new(user.encrypted_password)==password
user
else
nil
end
end
def encrypt_password
if password.present?
self.encrypted_password = BCrypt::Password.create(password)
end
end
I replaced the salt with:
def self.authenticate(email, password)
user = find_by_email(email)
if user && BCrypt::Password.new(user.encrypted_password)==password
user
else
nil
end
end
def encrypt_password
if password.present?
self.encrypted_password = BCrypt::Password.create(password)
end
end