From 49c58dc5de3688d842025b83cbc91a69ef621641 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Tue, 4 Mar 2025 13:47:36 -0500 Subject: Added reCAPTCHA to help filter spam comments --- app/controllers/comments_controller.rb | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'app/controllers/comments_controller.rb') diff --git a/app/controllers/comments_controller.rb b/app/controllers/comments_controller.rb index 9413339..31fe411 100644 --- a/app/controllers/comments_controller.rb +++ b/app/controllers/comments_controller.rb @@ -5,6 +5,12 @@ class CommentsController < ApplicationController raise ActiveRecord::RecordNotFound unless @blog raise ActiveRecord::RecordNotFound unless @blog.published + unless verify_recaptcha + flash.alert = "Error posting comment." + render "blogs/show" + return + end + @comment = @blog.comments.new(comment_params) @comment.request_ip = request.ip @comment.user_agent = request.user_agent -- cgit 1.4.1