diff options
| author | Star Rauchenberger <fefferburbia@gmail.com> | 2025-03-04 13:47:36 -0500 |
|---|---|---|
| committer | Star Rauchenberger <fefferburbia@gmail.com> | 2025-03-04 13:47:36 -0500 |
| commit | 49c58dc5de3688d842025b83cbc91a69ef621641 (patch) | |
| tree | 8ec526498a8b7ef4d076dcdd4f3ce0472af9149d /app/controllers | |
| parent | 0353d529e0d54a4a2d836afeb3224f3d53a649e4 (diff) | |
| download | thoughts-49c58dc5de3688d842025b83cbc91a69ef621641.tar.gz thoughts-49c58dc5de3688d842025b83cbc91a69ef621641.tar.bz2 thoughts-49c58dc5de3688d842025b83cbc91a69ef621641.zip | |
Added reCAPTCHA to help filter spam comments
Diffstat (limited to 'app/controllers')
| -rw-r--r-- | app/controllers/comments_controller.rb | 6 |
1 files changed, 6 insertions, 0 deletions
| 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 | |||
| 5 | raise ActiveRecord::RecordNotFound unless @blog | 5 | raise ActiveRecord::RecordNotFound unless @blog |
| 6 | raise ActiveRecord::RecordNotFound unless @blog.published | 6 | raise ActiveRecord::RecordNotFound unless @blog.published |
| 7 | 7 | ||
| 8 | unless verify_recaptcha | ||
| 9 | flash.alert = "Error posting comment." | ||
| 10 | render "blogs/show" | ||
| 11 | return | ||
| 12 | end | ||
| 13 | |||
| 8 | @comment = @blog.comments.new(comment_params) | 14 | @comment = @blog.comments.new(comment_params) |
| 9 | @comment.request_ip = request.ip | 15 | @comment.request_ip = request.ip |
| 10 | @comment.user_agent = request.user_agent | 16 | @comment.user_agent = request.user_agent |
