RailsCasts Pro episodes are now free!

Learn more or hide this

Aldo Román Nureña's Profile

GitHub User: aldo-roman

Comments by Aldo Román Nureña

Avatar

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