def self.authenticate(email, password) user = find_by(email: email) if user.present? && user.password_hash == User.hash_to_string( OpenSSL::PKCS5.pbkdf2_hmac(password, user.password_salt, ITERATIONS, DIGEST.length, DIGEST) ) user end end
Обсуждают сегодня